PDA

View Full Version : Solved: Send button value as arguement to macro



yoinkster
08-15-2008, 08:06 AM
Hey guys,

I have an index page with buttons on it with names of sheets and each one's been assigned it's own one line macro that is just

Sheets("<blah>").Select
How can do I send an arguement to the macro so I can have one macro to do the lot that is something like

Sub GoToSheet(buttonValue)
Sheets(buttonValue).Select
End Sub
so that each time one of the buttons is pushed, the macro knows the button's value {which is exactly the same as the sheet name} so can send it to the correct sheet?

Bob Phillips
08-15-2008, 08:39 AM
Worksheets(ActiveSheet.Buttons(Application.Caller).Caption).Select

yoinkster
08-15-2008, 08:58 AM
thanks mate, that's done the trick perfectly.