MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Macro to get a cell value and if true run another macro


Posted by John on July 03, 2001 9:48 PM

I have a spreadsheet that determines a value in one cell. If that value is equal to 12 I want it to run a macro that will open a sheet called aqs12 if the value is 32 a sheet called aqs32 and if 80 a sheet called aqs80.

Any help would be appreciated.


Posted by Russell on July 03, 2001 9:55 PM

You don't need 2 macros. It would look something like this (I'm assuming that you mean to move to the different sheet when you say, "open"):

Function OpenSheet()

Worksheets("aqs" & Range("A1").Value).Activate

End Function

This assumes that only those 3 values would be possible. Does this give you a starting point? If not, re-post as I won't be back on here until Thursday or Friday.

-Russell

Posted by John on July 05, 2001 4:44 PM


Thanks

It is necessary to run the macro because the macro sets up a page from a master page which remains unchanged. At present I run this macro using a button, but rather than having the user select which button to click I was hoping to automate the process.