Private Sub Command1_Click()’
'标准体重(kg)=身高(cm)-100 上下可浮动5kg
If Val(Text2.Text) < Val(Text1.Text) - 100 - 5 Then
MsgBox "你的身体太瘦,请注意营养", , "太瘦"
ElseIf Val(Text2.Text) >= Val(Text1.Text) - 100 - 5 And Val(Text2.Text) <= Val(Text1.Text) - 100 + 5 Then
MsgBox "你的身体标准,请继续保持", , "标准"
ElseIf Val(Text2.Text) > Val(Text1.Text) - 100 + 5 Then
MsgBox "你的身体太胖,请注意减肥", , "太胖"
End If
End Sub
c = Text1.Text / (Val(Text2.Text) / 100) ^ 2: Print c
If c < 18 Then MsgBox "瘦"
If c >= 18 And c <= 25 Then MsgBox "正常体重"
If c > 25 And c <= 30 Then MsgBox "超重"
If c > 30 And c <= 35 Then MsgBox "轻度肥胖"
If c > 35 And c <= 40 Then MsgBox "中度肥胖"
If c > 40 Then MsgBox "重度肥胖"
感谢2楼的,我把它压缩了一下
c = Text2.Text / (Val(Text3.Text)/100) ^ 2
Print c
If c < 18 Then
Text4 = "瘦"
End If
If c >= 18 And c <= 25 Then
Text4 = "正常体重"
End If
If c > 25 And c <= 30 Then
Text4 = "超重"
End If
If c > 30 And c <= 35 Then
Text4 = "轻度肥胖"
End If
If c > 35 And c <= 40 Then
Text4 = "中度肥胖"
End If
If c > 40 Then
Text4 = "重度肥胖"
End If