OzGrid

How to select cell A1 on all sheets prior to closing the workbook

< Back to Search results

 Category: [Excel]  Demo Available 

How to select cell A1 on all sheets prior to closing the workbook

 

Requirement:

 

To select Cell A1 on all sheets prior to closing the workbook.

 

Solution:

 

Code:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim sht As Worksheet
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
    For Each sht In ThisWorkbook.Worksheets
        Application.Goto sht.Range("A1"), True
    Next sht
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub

 

Obtained from the OzGrid Help Forum.

Solution provided by Carim.

 

See also: Index to Excel VBA Code and Index to Excel Freebies and Lesson 1 - Excel Fundamentals and Index to how to… providing a range of solutions and Index to new resources and reference sheets

 

See also:

How to paste from multiple Excel workbooks into one workbook (Across the page & file names)
How to use read only when opening a workbook
How to use VBA code to output multiple worksheets to separate workbooks
How to search for a word inside a workbook and open that sheet as active sheet
How to compare two workbooks with multiple sheets and highlighting duplicates

 

Click here to visit our Free 24/7 Excel/VBA Help Forum where there are thousands of posts you can get information from, or you can join the Forum and post your own questions.


Gallery



stars (0 Reviews)