Resetting Multiple Sheets on Workbook Open

drewberts

Board Regular
Joined
Sep 5, 2013
Messages
187
Office Version
  1. 365
Platform
  1. Windows
I'm trying to set zoom level as well as each sheet having the last empty cell selected. I have a button on each sheet which manually selects and scrolls to the last cell using:-

ActiveSheet.ShowAllData
Range("Table1").Cells(1, 2).End(xlDown).Offset(1).Select
ActiveWindow.ScrollColumn = 1

This works fine when clicking the button but I want to automate this for each sheet on workbook_open. I'm using the following (which I know is wrong, but I don't know why):-

Private Sub Workbook_Open()
On Error Resume Next
Application.ScreenUpdating = False

Dim ws As Worksheet

For Each ws In Worksheets
ws.Select
ActiveWindow.Zoom = 75
ActiveSheet.ShowAllData
Range("Table1").Cells(1, 2).End(xlDown).Offset(1).Select
ActiveWindow.ScrollColumn = 1
Range("Table2").Cells(1, 2).End(xlDown).Offset(1).Select
ActiveWindow.ScrollColumn = 1
Range("Table3").Cells(1, 2).End(xlDown).Offset(1).Select
ActiveWindow.ScrollColumn = 1
Next ws

Application.ScreenUpdating = True
End Sub
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Have you tried stepping through it manually to see what it does? You'll have to put it into a standard module for that, but it should show you what's "not working". To me, it looks like it should do what your individual 3 line code does only in each worksheet.

You might comment out the "on error resume next" and "screenupdating" lines and make sure it's not finding an error and skipping something.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,225,750
Messages
6,186,808
Members
453,373
Latest member
Ereha

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