snasui.com ยินดีต้อนรับ ยินดีต้อนรับสู่กระดานถามตอบ Excel and VBA และอื่น ๆ ที่เป็นมิตรกับทุกท่าน มีไฟล์แนบมหาศาล ช่วยให้ท่านค้นหาและติดตามศึกษาได้โดยง่าย สมาชิกท่านใดที่ยังไม่ได้ระบุ Version ของ Excel ที่ใช้งานจริง สามารถทำตาม Link นี้เพื่อจะได้รับคำตอบที่ตรงกับ Version ของท่านครับ ระบุ Version ของ Excel
Private Sub CheckBox1_Click()
If CheckBox1.Value Then
A = 66
Weight = 13.7
Height = 5
Old = 6.8
End If
Sheet1.Cells(2, 3) = CheckBox1.Caption
End Sub
Private Sub CheckBox2_Click()
Sheet1.Cells(2, 3) = CheckBox2.Caption
If CheckBox2.Value Then
A = 66.5
Weight = 9.6
Height = 1.8
Old = 4.7
End If
End Sub
Private Sub CommandButton1_Click()
Dim A As Double
Dim Weight As Double
Dim Height As Double
Dim Old As Double
Dim Weight2 As Double
Dim Height2 As Double
Dim Old As Double
Dim BMR As Double
Weight2 = Weight + TextBox1.Value
Height2 = Height + TextBox2.Value
Old2 = Old + TextBox3.Value
BMR = A + Weight2 + Height2 + Old2 * Work
TextBox4.Value = BMR
End Sub
Private Sub OptionButton1_Click()
End Sub
Private Sub OptionButton3_Click()
Dim Work As Single
Work = 1.2
Sheet1.Cells(6, 3) = OptionButton3.Caption
End Sub
Private Sub OptionButton4_Click()
Dim Work As Single
Work = 1.55
Sheet1.Cells(6, 3) = OptionButton4.Caption
End Sub
Private Sub OptionButton5_Click()
Dim Work As Single
Work = 1.99
Sheet1.Cells(6, 3) = OptionButton5.Caption
End Sub
Private Sub TextBox1_Change()
Sheet1.Cells(3, 3) = TextBox1.Value
If TextBox1.Value = "" Then
MsgBox " กรุณาใส่ตัวเลข "
End If
End Sub
Private Sub TextBox2_Change()
Sheet1.Cells(4, 3) = TextBox2.Value
If TextBox2.Value = "" Then
MsgBox " กรุณาใส่ตัวเลข "
End If
End Sub
Private Sub TextBox3_Change()
Sheet1.Cells(5, 3) = TextBox3.Value
If TextBox3.Value = "" Then
MsgBox " กรุณาใส่ตัวเลข "
End If
End Sub
Private Sub TextBox4_Change()
End Sub
Private Sub UserForm_Click()
MsgBox ("I love you.")
End Sub