VBA code for going to the First Worksheet - Excel Mac 365

ExcelBeginner445

New Member
Joined
Nov 24, 2018
Messages
5
Is there a Macro that can be made to go to the first worksheet in an excel file - regardless of the name of the worksheet

I am not a programmer and do not understand anything about Visual Basics. I was hoping to find some VBA Code that I can paste into the VBA Editor in order to do this.
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Hi & welcome to MrExcel.
Try
Sub GotoSheet()
Sheets(1).Activate
End Sub
 
Upvote 0
Thank you very much for the help!

I find that this may not work if the first worksheet was since deleted (e.g. if I delete worksheet 1 and now worksheet 2 is my first worksheet - ie the worksheet furthest to the left).

Is there a way around this?
 
Upvote 0
The code should always take you the first sheet in the workbook (from left to right) regardless if you have deleted any
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top