Okay, so I've never had to do anything in VBA where I was REQUIRED to activate a sheet or select a cell. But, now, I'm trying to figure out how to do Zoom to 100% on a bunch of worksheets, and all the code I see (google results, including answers from this website) seems to select a sheet first:
ActiveWindow.Zoom = 100
But, I did find some code on OzGrid that seems to imply it's possible to do it without selecting a sheet first:
Sht.PageSetup.Zoom = 100
(although above we have Set Sht = ActiveSheet) I tried doing
Set Sht = ThisWorkbook.Worksheets("Sheet1")
Sht.PageSetup.Zoom = 150
but nothing happens... literally nothing.
So, is this possible? Or must I activate a worksheet before I can do the zooming? I've read so many times that this is bad programming practice, unless you absolutely have to.
Yes, I believe zooming is something that only has an effect on an active sheet.
However, if you didn't want to 'see' each sheet getting activated and zoomed as it happens, you could add the line
before your zoom code and then after it is done:
Setting
Application.Screenupdating = False
will not solve your problem. If you select a sheet or activate a sheetApplication.screenupdating
will be set to true.