#1   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default ComboBox

Hi,

I have a comboBox embeded on a worksheet. The comboBox is
from the "Form" menu. It shows four items in the dropdown
list. My problem is how do I assign macros to these four
items, so when one is selected an assigned macro would
run. Also, how do I refer to this comboBox in my codes?
Thanks for your help.

Kind Regards
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 535
Default ComboBox

Hi,

I have a comboBox embeded on a worksheet. The comboBox is
from the "Form" menu. It shows four items in the dropdown
list. My problem is how do I assign macros to these four
items, so when one is selected an assigned macro would
run. Also, how do I refer to this comboBox in my codes?
Thanks for your help.


Like this:

- Rightclick the dropdown
- select Attach macro
- hit the New button

Paste in this code between the Sub ... and End Sub lines that are
automatically inserted:

With ActiveSheet.DropDowns(Application.Caller)
Select Case .Value
Case "1"
MsgBox "You selected item 1)"
Case "2"
MsgBox "You selected item 2)"
Case "3"
MsgBox "You selected item 3)"
Case "4"
MsgBox "You selected item 4)"
End Select
End With

Regards,

Jan Karel Pieterse
Excel MVP
www.jkp-ads.com

  #3   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default ComboBox

Hi,
Thanks for your help. This works. Thanks.

-----Original Message-----
Hi,

I have a comboBox embeded on a worksheet. The comboBox

is
from the "Form" menu. It shows four items in the

dropdown
list. My problem is how do I assign macros to these

four
items, so when one is selected an assigned macro would
run. Also, how do I refer to this comboBox in my codes?
Thanks for your help.


Like this:

- Rightclick the dropdown
- select Attach macro
- hit the New button

Paste in this code between the Sub ... and End Sub lines

that are
automatically inserted:

With ActiveSheet.DropDowns(Application.Caller)
Select Case .Value
Case "1"
MsgBox "You selected item 1)"
Case "2"
MsgBox "You selected item 2)"
Case "3"
MsgBox "You selected item 3)"
Case "4"
MsgBox "You selected item 4)"
End Select
End With

Regards,

Jan Karel Pieterse
Excel MVP
www.jkp-ads.com

.

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 combobox depending on selection from another combobox Adam Francis Excel Discussion (Misc queries) 2 July 24th 08 07:39 PM
Combobox N.F[_2_] Excel Discussion (Misc queries) 2 August 17th 07 02:05 AM
combobox into another combobox girlie New Users to Excel 1 September 26th 06 10:31 AM
ComboBox Darrin Henry Excel Programming 0 September 15th 03 06:05 PM
combobox Nicky* Excel Programming 3 July 28th 03 09:26 PM


All times are GMT +1. The time now is 07:22 AM.

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

About Us

"It's about Microsoft Excel"