![]() |
|
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Join Date: Mar 2004
Location: NYC
Posts: 193
|
Hi There, great resource here - I am new, and trying to develop a very simple application, the question may be very trivial to most of you.
What I desire is a listbox (drop down list) on an Excel worksheet that executes a VB macro. The macro can be anything, but in my case, it will direct the person who makes the selection to a specific worksheet. here is what I have so far ... -------------------------------------- Private Sub ListBox1_Click() End Sub -------------------------------------- I either need a selection that allows me to drop a text message, and then runs a macro, or ... goes directly to a spreadsheet (ie: via path and filename) I appreciate your help and keep up the good work, sorry for posting such a trivial question. Regards |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Apr 2003
Location: Alaska
Posts: 7,332
|
Howdy,
No such thing as trivial questions...just some that are easier to solve than others. Here's an example of one way to do what (I think) you've asked. For the listbox's input range I used D1:D11. Then in D1 I entered Sheet 1, D2 = Sheet 2, D3 = Sheet 3, etc. down to D11 = Sheet 11. Then I used C1 as the Cell Link for the listbox. Now, for the code. Right click on the listbox and choose Assign Macro > New (or Edit) and paste this in there. Code:
Sub ListBox1_Change() Dim x As Integer x = [C1].Value MsgBox "You have chosen to go to sheet " & x Sheets(x).Select End Sub This give you any ideas? Dan
__________________
XP & '03 Vista & '07 |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|