Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default 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.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Fill values into a listbox matching selected values from a combobox Jon[_19_] Excel Programming 4 January 25th 05 04:25 PM
ComboBox Values Jim Berglund Excel Programming 4 August 17th 04 10:18 PM
Assigning Multiple Macros to One ComboBox Control Tim Zych[_2_] Excel Programming 0 July 23rd 03 06:36 PM
Assigning Multiple Macros to One ComboBox Control Michael J. Malinsky Excel Programming 0 July 23rd 03 06:10 PM
ComboBox Values Darren[_3_] Excel Programming 1 July 16th 03 10:41 AM


All times are GMT +1. The time now is 05:51 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"