![]() |
Combobox values used in macros
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. |
Combobox values used in macros
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" 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. |
Combobox values used in macros
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 = ..... PaulaO wrote: 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. -- Dave Peterson |
All times are GMT +1. The time now is 06:02 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com