ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Can a macro be written that when you open a workbook the zoom will be set for each sheet? (https://www.excelbanter.com/excel-programming/358116-can-macro-written-when-you-open-workbook-zoom-will-set-each-sheet.html)

Marc

Can a macro be written that when you open a workbook the zoom will be set for each sheet?
 
Marc



Gary Keramidas

Can a macro be written that when you open a workbook the zoom will be set for each sheet?
 
maybe something like this in a code module

Option Explicit

Dim sheet As Worksheet
Sub Auto_Open()
For Each sheet In ThisWorkbook.Worksheets
sheet.Activate
ActiveWindow.Zoom = 200
Next
End Sub

--


Gary


"Marc" wrote in message
. net...
Marc





dok112[_116_]

Can a macro be written that when you open a workbook the zoom will be set for each sheet?
 

Yes.

In Microsoft Visual Basic Editor, under ObjectsThisWorkbook, input th
following code:

Private Sub Workbook_Open()
For Each ws In Worksheets
ws.select
ActiveWindow.Zoom = 100
Next
End Sub

Change the zoom to whatever zoom you want it to be. do not include th
% symbo

--
dok11
-----------------------------------------------------------------------
dok112's Profile: http://www.excelforum.com/member.php...fo&userid=1058
View this thread: http://www.excelforum.com/showthread.php?threadid=53016


Marc

Can a macro be written that when you open a workbook the zoom will be set for each sheet?
 
Thanks I get tired of have to do each sheet manually.

Marc

"Marc" wrote in message
. net...
Marc





Marc

Can a macro be written that when you open a workbook the zoom will be set for each sheet?
 
Spoke to soon. I copied it and change the 100 to 75 and tried to run it and
I get a run time error '1004' "Select method of Worksheet class failed".

Marc

"dok112" wrote in
message ...

Yes.

In Microsoft Visual Basic Editor, under ObjectsThisWorkbook, input the
following code:

Private Sub Workbook_Open()
For Each ws In Worksheets
ws.select
ActiveWindow.Zoom = 100
Next
End Sub

Change the zoom to whatever zoom you want it to be. do not include the
% symbol


--
dok112
------------------------------------------------------------------------
dok112's Profile:

http://www.excelforum.com/member.php...o&userid=10581
View this thread: http://www.excelforum.com/showthread...hreadid=530168




dok112[_117_]

Can a macro be written that when you open a workbook the zoom will be set for each sheet?
 

You will get that error if you have put the code in the wrong spot, or
if you are attempting to make the zoom too large. You can go from 10
to 400 percent. If you put that code in a regular module, you will get
that error. It has to go into the ThisWorkbook object so it knows to do
it when it opens.

Marc Wrote:
Spoke to soon. I copied it and change the 100 to 75 and tried to run it
and
I get a run time error '1004' "Select method of Worksheet class
failed".

Marc

"dok112" wrote
in
message ...

Yes.

In Microsoft Visual Basic Editor, under ObjectsThisWorkbook, input

the
following code:

Private Sub Workbook_Open()
For Each ws In Worksheets
ws.select
ActiveWindow.Zoom = 100
Next
End Sub

Change the zoom to whatever zoom you want it to be. do not include

the
% symbol


--
dok112

------------------------------------------------------------------------
dok112's Profile:

http://www.excelforum.com/member.php...o&userid=10581
View this thread:

http://www.excelforum.com/showthread...hreadid=530168



--
dok112
------------------------------------------------------------------------
dok112's Profile: http://www.excelforum.com/member.php...o&userid=10581
View this thread: http://www.excelforum.com/showthread...hreadid=530168



All times are GMT +1. The time now is 10:41 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com