I am attempting to write a simple basic userform with two comboboxes with select case to learn how it works before I add it to my extensive report.
This uerform has two comboboxes with submit and cancel buttons, that's it.
I wrote the code here, focusing on combobox 1 for now. (Combo box 2 will be added later).
After executing the code in immediate window, it says "Compile Error: Invalid use of property". I wonder why.
Formula:
Private Sub Yr_Change()
Select Case Me.Yr.Value
Case "2012"
MsgBox ("Hello, World!")
Case "2013"
MsgBox ("Whaa...?")
Case "2014"
MsgBox ("Howdy 2014!")
End Select
End Sub
Private Sub UserForm_Initialize()
With Me.Yr
.AddItem "2012"
.AddItem "2013"
.AddItem "2014"
End With
End Sub
Private Sub cmdCancel()
Unload Me
End Sub
Bookmarks