Microsoft Surface Book 2 15in review
I want to create a button in my worksheet so when clicked it goes to another worksheet within the workbook. As i have about 5-6 worksheets and i dont want to have to click on the tabs at the bottom of the screen, each time i want to change the worksheet. I am finding it difficult to write the Visual Basic Code for it can anyone help me please.
about which sheet is is you want to go to each time?
The easiest way to learn the code, I've found, is to record a macro, and look at the code it creates.
In this instance;
1)Draw your button on the sheet
2)Exit "design mode" on thge VBA toolbar
3)Record a new macro, (via Tools>Macros>RecordNewMacro) When the dialog box appears asking for a macro name, just take the default,"Macro1", don't do anything else, and click OK.
4)You should now have a small toolbar on screen with a square, blue button. This is the "Stop recording" button. Select another sheet, using the tabs at the bottom, then hit the "stop recording button.
5)Look at the macro you have just recorded by clicking Tools>Macro>Macros selct macro1 in the box and click "edit" This will open the VisBasic editor and you can see the code. Copy this code, missing out the lines "Sub Macro1" and "End Sub". (Anything in green is "comment" and doesn't cause anything to happen)
6)Click the tab for the sheet with the button on.
7)Click the button on the visbasic toolbar to go into "design mode"
8)Right click the button and choose "view code"
9)Paste the code you previously copied into the vb editor, between the lines "private sub" and "end sub"
10)Back to the spreadsheet, out of design mode and pressing the button will select the chosen sheet as per the macro you recorded.
Apologies if that's oversimplified. Does that help?
Thanks alot Simsy thats has really helped me. You have been a Life Saver Cheers Mate
This thread is now locked and can not be replied to.