Combobox values used in macros

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to get the value selected in a combobox from a userform to be the
subject of a select case statement.

For example, in Userform2, the combobox is going to select a month, then I
want the selection to become the value of a variable in a select case
statement in a macro. I am not sure how to get the selected value to flow
through.

Any assistance would be appreciated.
 
Something like...

Sub DependingOnTheMonth()
Dim strMonth As String
Dim strResult As String
strMonth = UserForm2.ComboBox1.Value

Select Case strMonth
Case "January"
strResult = "Shovel Snow"
Case "February"
strResult = "Go on Vacation"
'march thru december
Case Else
End Select
End Sub
'--------------

Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"PaulaO" <[email protected]>
wrote in message
I need to get the value selected in a combobox from a userform to be the
subject of a select case statement.

For example, in Userform2, the combobox is going to select a month, then I
want the selection to become the value of a variable in a select case
statement in a macro. I am not sure how to get the selected value to flow
through.

Any assistance would be appreciated.
 
If the code is under that userform:

dim myStr as string
mystr = me.combobox1.value

select case lcase(mystr)
case is = "january"
'do something
case is = .....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top