ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Use Combo Box value to determine macro used (https://www.excelbanter.com/excel-worksheet-functions/171647-use-combo-box-value-determine-macro-used.html)

Richhall[_2_]

Use Combo Box value to determine macro used
 
Hi

I have a combo box with different months in. The user will select a
month then select a button to determine what report to run. I have 5
buttons for each month, so rather than have 60 buttons, I want to
select the Month, and then the user chooses the button. I then want
the button to use the month to determine the macro it should run.

I've done it so that the combo box sends a number to a cell (i.e Dec =
12) and then I use VLookup to return the month again in a different
cell (i,.e B13). I then have a number of Macros, i,e JanMacroA, Jan
MacroB, JanMacroN, and repeated for FebMacroA, etc for all the months
and thought maybe I could use the text value and put this in each
macro. i,e Run "B13"MacroA. Alternatively, all the Macros are the
same for each month, and just reference sheets etc. So if I could
create 5 single macros for each of the buttons, and use the combobox
value within the macro this would be great. For example this is one of
the simple macros:

Sheets("Jan 08").Visible = True
Selection.AutoFilter Field:=2, Criteria1:="Night"

So I want the Jan 08 to be whatever is in "B13" 08??

Can anyone help please?

Cheers

Rich

Richhall[_2_]

Use Combo Box value to determine macro used
 
In addition, I have also used the B13 value to add into another field
and create the names I need:

i.e

B13 ComboBox Selection e.g. Jan
B14 08
B15 =B13&B14 e.g. Jan 08

So basically just need to know how to use this value as text in a
macro.

Cheers

Rich



All times are GMT +1. The time now is 08:51 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com