sabhay
11-22-2012, 12:29 PM
I am trying to a make unit converter in VBA using userform.
I am getting a value in combobox2 say "Degree" & a value in Combobox3 say "Radian"
In a function called calculate() , I want to do calculation & display result in textbox2
but before calculating I want to check & assign some numbers to combobox values. Can I do this..?????
following is part of my coding:
Private Sub calculation()
Dim Degree, Radian, Gradian As Double
If TextBox1 <> "" And ComboBox2 <> "" And ComboBox3 <> "" Then
If ComboBox2.Value = ComboBox3.Value Then TextBox2.Value = TextBox1.Value
Degree = 1
Radian = 1.11111
Gradian = 0.017453293
TextBox2.Value = ComboBox3 / ComboBox2
End If
End Sub
I am getting a value in combobox2 say "Degree" & a value in Combobox3 say "Radian"
In a function called calculate() , I want to do calculation & display result in textbox2
but before calculating I want to check & assign some numbers to combobox values. Can I do this..?????
following is part of my coding:
Private Sub calculation()
Dim Degree, Radian, Gradian As Double
If TextBox1 <> "" And ComboBox2 <> "" And ComboBox3 <> "" Then
If ComboBox2.Value = ComboBox3.Value Then TextBox2.Value = TextBox1.Value
Degree = 1
Radian = 1.11111
Gradian = 0.017453293
TextBox2.Value = ComboBox3 / ComboBox2
End If
End Sub