今日練習BMI caculator , 一直出現overflow的錯誤訊息.
看起來有問題的程式碼是:bmi = weight /(height/100)²
第四行&第五行應該是要改成:
Height= Range(“B4”) Weight=Rang3(“B5”)
改寫成如下,就不再出現溢位訊息~
Sub ElseIfBMI()
Dim height As Integer: height = Range(“B4”)
Dim weight As Double: weight = Range(“B5”)
Dim bmi As Double
Dim result As String
bmi = weight / (height * height / 10000)