Try putting this in the userform's code module
Private Sub UserForm_Initialize()
With Me.ComboBox1
.ColumnCount = 2
.ColumnWidths = ";0"
.AddItem "bar"
.AddItem "psi"
.AddItem "pascal"
Rem conversion units from .listindex to bar
.List(0, 1) = 1
.List(1, 1) = 14.5
.List(2, 1) = 100000#
.ListIndex = 0
End With
TextBox1.Text = vbNullString
End Sub
Private Sub ComboBox1_Click()
With ComboBox1
TextBox1.Text = CStr(Val(TextBox1.Tag) * Val(.List(.ListIndex, 1)))
End With
End Sub
Private Sub TextBox1_AfterUpdate()
Dim Amount As Double
Dim AmountInBars As Double
Amount = Val(TextBox1.Text)
With ComboBox1
AmountInBars = Amount * .List(.ListIndex, 1)
End With
TextBox1.Tag = AmountInBars
End Sub
Bookmarks