Hi,
I am trying to write a program for a user form which takes data from the user interface and calculates on the command click and I am trying to do using if else statements but something is wrong can any body help me with this. The code have written is below. I am a beginner and just started using VBA.
Thanks
Private Sub Tolerance_Click()
Dim Msg1 As String
Msg1 = Msg1 & ComboBox1
Dim D As Integer
D = D & TextBox1
Dim L As Integer
L = L & TextBox2
Dim Ts As Integer
Dim S As Integer
Dim Ci As Integer
Dim Cy As Integer
If Msg1 = "Size" Then
Select Case D
Case Is >= 0.25
Ts = 0.001 + (0.006 + 0.005 * D)
Case Is < 0.25
Ts = 0.001 + (0.003 + 0.016 * D)
MsgBox Ts
End Select
If Msg1 = "Straightness" Then
S = L * 0.0087
MsgBox S
If Msg1 = "Circularity" Then
Ci = 0.25 * Size
MsgBox Ci
If Msg1 = "Cylindricity" Then
Cy = S + Ci
MsgBox Cy
End If
End Sub
Bookmarks