Your logic makes perfect sense to me, but it won't work, probably
because of how I'm inputting the values from the UserForm in the first
place. I have a CommandButton that adds the values entered in the
UserForm to certain cells in the spreadsheet all at once. But when I
insert the code for ComboBox1_Change() it crashes when something in the
ComboBox is chosen. Here is my code:
Private Sub CloseButton_Click()
Unload Me
End Sub
______________
Private Sub cmdAdd_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("CostModelData")
'find first empty row in database
iRow = 2
'check for a destination city
If Trim(Me.ComboBox1.Value) = "" Then
Me.ComboBox1.SetFocus
Exit Sub
End If
'copy the data to the database
ws.Cells(iRow, 15).Value = Me.ComboBox1.Value
ws.Cells(iRow, 16).Value = Me.txtMCFloor.Value
ws.Cells(iRow, 17).Value = Me.txtDiscount.Value
'clear the data
Me.ComboBox1.Value = ""
Me.txtMCFloor.Value = ""
Me.txtDiscount.Value = ""
Me.ComboBox1.SetFocus
End Sub
_____________
Private Sub ComboBox1_Change()
Me.Label3.Caption =
Application.WorksheetFunction.VLookup(Me.ComboBox1.Value,
Worksheets("Sheet1").Range("Data"), 2, False)
End Sub
_____________
Private Sub UserForm_Click()
End Sub