Macro Mondays – A Quick Macro To Open A Spreadsheet To A Particular Sheet And Cell


This really is a very quick #macromonday tip for you. Have you got a large Excel workbook with lots of worksheets?. It’s sometimes really handy to be able to open your workbook straight to the worksheet you want to.

An Excel workbook will by default re open up on the last sheet that was active when it was saved. If you want to over ride this this you can do so with a small piece of VBA code.

 

What Does The Macro Do?

This macro will automatically go to the Sheet that you specify in the code. In this example it is Sheet1.

 

How Does It Work?

MACRO MONDAYS OPENA SPREADSHEET TO A PARTICULAR WORKSHEETpng

We use the Workbook_Open event which is a procedure of the Workbook Object, and specify in the code for Excel to select Sheet1 when the workbook is opened, thus overriding any default sheet that the workbook saved on. A really straightforward piece of VBA.

the Workbook_Open procedure MUST reside in the private module of the Workbook Object (ThisWorkbook).

 

You need to install this piece of code into Excel which is easy to do.

  1. Hit ALT + F11
  2. Click on ThisWorkBook in the Project VBA Window
  3. You will now see the This Workbook code module- double click to open it
  4. Enter or copy the above code into This Workbook code module making sure you change the sheet name you want the workbook to open up on
  5. Hit ATL+F11
  6. Save the the workbook

Want To Copy The Code?

[stextbox id=”grey”]

‘macro by howtoexcelatexcel.com
Private Sub Workbook_Open()

Sheets(“Sheet1”).Select ‘Change this to your sheet name

End Sub

[/stextbox]


If you want to see all of my blog posts in the Macro Mondays Series you can find them all in the link below. Why not book mark it?, Yes it is updated EVERY Monday.

You can also download the corresponding example workbook that contains the Macro code by clicking on the download button below.

How To Excel At Excel – Macro Mondays Blog Posts.

[wpdm_package id=’10338′]

Learn Excel With Our Excel Online Courses

Barbara

Barbara is an experienced data analyst with over 20 years of experience. Author of the How To Excel At Excel Top 50 Excel tips Ebook, YouTuber and Excel Blogger.

Recent Posts