Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,560
Default Zoom Property - 1004 Error

I have a macro that takes the column widths and row heights from the
worksheet I run the macro from and applies them to all the other worksheets
that aren't named a certain name. I would like to include the zoom property
in this macro, but I'm getting a 1004 error - Unable to set the Zoom property
of the PageSetup class.

The code names the active worksheet mastersht, and then goes to each sht not
named a particular name. It set the columns and rows and then bombs out on
the zoom property. Here's the code:

Dim Answer, Col, Row, Sht
Dim MasterRngC As Range
Dim MasterRngR As Range
Dim MasterRngZ As String
Dim MasterSht As String
Dim Msg As String

Msg = "Do you want to apply this Worksheet's Column" & vbCrLf _
& "Widths and Row Heights to all the P# Worksheets?"
Answer = MsgBox(Msg, vbInformation + vbYesNo)
If Answer = vbNo Then Exit Sub

MasterSht = ActiveSheet.Name
Set MasterRngC = ActiveSheet.Range("A1", "K1")
Set MasterRngR = ActiveSheet.Range("A1", "A37")
MasterRngZ = ActiveSheet.PageSetup.Zoom

For Each Sht In Worksheets
If Sht.Name < MasterSht Then
If Sht.Name < "Index" Then
For Each Col In MasterRngC
Sht.Range(Col.Address).ColumnWidth = Col.ColumnWidth
Next Col
For Each Row In MasterRngR
Sht.Range(Row.Address).RowHeight = Row.RowHeight
Next Row
ActiveSheet.PageSetup.Zoom = MasterRngZ
End If
End If

Next Sht

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 139
Default Zoom Property - 1004 Error

David:

MasterRngZ as Integer

replace code
Dim MasterRngZ As Integer
--
天行健,君*以自強不息
地勢坤,君*以厚德載物

http://www.vba.com.tw/plog/


"David" wrote:

I have a macro that takes the column widths and row heights from the
worksheet I run the macro from and applies them to all the other worksheets
that aren't named a certain name. I would like to include the zoom property
in this macro, but I'm getting a 1004 error - Unable to set the Zoom property
of the PageSetup class.

The code names the active worksheet mastersht, and then goes to each sht not
named a particular name. It set the columns and rows and then bombs out on
the zoom property. Here's the code:

Dim Answer, Col, Row, Sht
Dim MasterRngC As Range
Dim MasterRngR As Range
Dim MasterRngZ As String
Dim MasterSht As String
Dim Msg As String

Msg = "Do you want to apply this Worksheet's Column" & vbCrLf _
& "Widths and Row Heights to all the P# Worksheets?"
Answer = MsgBox(Msg, vbInformation + vbYesNo)
If Answer = vbNo Then Exit Sub

MasterSht = ActiveSheet.Name
Set MasterRngC = ActiveSheet.Range("A1", "K1")
Set MasterRngR = ActiveSheet.Range("A1", "A37")
MasterRngZ = ActiveSheet.PageSetup.Zoom

For Each Sht In Worksheets
If Sht.Name < MasterSht Then
If Sht.Name < "Index" Then
For Each Col In MasterRngC
Sht.Range(Col.Address).ColumnWidth = Col.ColumnWidth
Next Col
For Each Row In MasterRngR
Sht.Range(Row.Address).RowHeight = Row.RowHeight
Next Row
ActiveSheet.PageSetup.Zoom = MasterRngZ
End If
End If

Next Sht

End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,560
Default Zoom Property - 1004 Error

Thanks...that got rid of the error, but the code still does not change the
zoom to the setting from the mastersht, which is 85. They are still at 100.
Any suggestions?

"chijanzen" wrote:

David:

MasterRngZ as Integer

replace code
Dim MasterRngZ As Integer
--
天行健,君*以自強不息
地勢坤,君*以厚德載物

http://www.vba.com.tw/plog/


"David" wrote:

I have a macro that takes the column widths and row heights from the
worksheet I run the macro from and applies them to all the other worksheets
that aren't named a certain name. I would like to include the zoom property
in this macro, but I'm getting a 1004 error - Unable to set the Zoom property
of the PageSetup class.

The code names the active worksheet mastersht, and then goes to each sht not
named a particular name. It set the columns and rows and then bombs out on
the zoom property. Here's the code:

Dim Answer, Col, Row, Sht
Dim MasterRngC As Range
Dim MasterRngR As Range
Dim MasterRngZ As String
Dim MasterSht As String
Dim Msg As String

Msg = "Do you want to apply this Worksheet's Column" & vbCrLf _
& "Widths and Row Heights to all the P# Worksheets?"
Answer = MsgBox(Msg, vbInformation + vbYesNo)
If Answer = vbNo Then Exit Sub

MasterSht = ActiveSheet.Name
Set MasterRngC = ActiveSheet.Range("A1", "K1")
Set MasterRngR = ActiveSheet.Range("A1", "A37")
MasterRngZ = ActiveSheet.PageSetup.Zoom

For Each Sht In Worksheets
If Sht.Name < MasterSht Then
If Sht.Name < "Index" Then
For Each Col In MasterRngC
Sht.Range(Col.Address).ColumnWidth = Col.ColumnWidth
Next Col
For Each Row In MasterRngR
Sht.Range(Row.Address).RowHeight = Row.RowHeight
Next Row
ActiveSheet.PageSetup.Zoom = MasterRngZ
End If
End If

Next Sht

End Sub

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 414
Default Zoom Property - 1004 Error

Are you sure you are changing the correct Zoom? If you are wanting to
change the screen Zoom as shown on the Standard toolbar then that is:

ActiveWindow.Zoom = 85 'or your variable

Hope the helps
Rowan

David wrote:
Thanks...that got rid of the error, but the code still does not change the
zoom to the setting from the mastersht, which is 85. They are still at 100.
Any suggestions?

"chijanzen" wrote:


David:

MasterRngZ as Integer

replace code
Dim MasterRngZ As Integer
--
天行健,君*以自強不息
地勢坤,君*以厚德載物

http://www.vba.com.tw/plog/


"David" wrote:


I have a macro that takes the column widths and row heights from the
worksheet I run the macro from and applies them to all the other worksheets
that aren't named a certain name. I would like to include the zoom property
in this macro, but I'm getting a 1004 error - Unable to set the Zoom property
of the PageSetup class.

The code names the active worksheet mastersht, and then goes to each sht not
named a particular name. It set the columns and rows and then bombs out on
the zoom property. Here's the code:

Dim Answer, Col, Row, Sht
Dim MasterRngC As Range
Dim MasterRngR As Range
Dim MasterRngZ As String
Dim MasterSht As String
Dim Msg As String

Msg = "Do you want to apply this Worksheet's Column" & vbCrLf _
& "Widths and Row Heights to all the P# Worksheets?"
Answer = MsgBox(Msg, vbInformation + vbYesNo)
If Answer = vbNo Then Exit Sub

MasterSht = ActiveSheet.Name
Set MasterRngC = ActiveSheet.Range("A1", "K1")
Set MasterRngR = ActiveSheet.Range("A1", "A37")
MasterRngZ = ActiveSheet.PageSetup.Zoom

For Each Sht In Worksheets
If Sht.Name < MasterSht Then
If Sht.Name < "Index" Then
For Each Col In MasterRngC
Sht.Range(Col.Address).ColumnWidth = Col.ColumnWidth
Next Col
For Each Row In MasterRngR
Sht.Range(Row.Address).RowHeight = Row.RowHeight
Next Row
ActiveSheet.PageSetup.Zoom = MasterRngZ
End If
End If

Next Sht

End Sub

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,560
Default Zoom Property - 1004 Error

That did it! I was using the print zoom. Thanks much!!! I so much appreciate
all the help I get out here!

Many thanks again!!

"Rowan Drummond" wrote:

Are you sure you are changing the correct Zoom? If you are wanting to
change the screen Zoom as shown on the Standard toolbar then that is:

ActiveWindow.Zoom = 85 'or your variable

Hope the helps
Rowan

David wrote:
Thanks...that got rid of the error, but the code still does not change the
zoom to the setting from the mastersht, which is 85. They are still at 100.
Any suggestions?

"chijanzen" wrote:


David:

MasterRngZ as Integer

replace code
Dim MasterRngZ As Integer
--
天行健,君*以自強不息
地勢坤,君*以厚德載物

http://www.vba.com.tw/plog/


"David" wrote:


I have a macro that takes the column widths and row heights from the
worksheet I run the macro from and applies them to all the other worksheets
that aren't named a certain name. I would like to include the zoom property
in this macro, but I'm getting a 1004 error - Unable to set the Zoom property
of the PageSetup class.

The code names the active worksheet mastersht, and then goes to each sht not
named a particular name. It set the columns and rows and then bombs out on
the zoom property. Here's the code:

Dim Answer, Col, Row, Sht
Dim MasterRngC As Range
Dim MasterRngR As Range
Dim MasterRngZ As String
Dim MasterSht As String
Dim Msg As String

Msg = "Do you want to apply this Worksheet's Column" & vbCrLf _
& "Widths and Row Heights to all the P# Worksheets?"
Answer = MsgBox(Msg, vbInformation + vbYesNo)
If Answer = vbNo Then Exit Sub

MasterSht = ActiveSheet.Name
Set MasterRngC = ActiveSheet.Range("A1", "K1")
Set MasterRngR = ActiveSheet.Range("A1", "A37")
MasterRngZ = ActiveSheet.PageSetup.Zoom

For Each Sht In Worksheets
If Sht.Name < MasterSht Then
If Sht.Name < "Index" Then
For Each Col In MasterRngC
Sht.Range(Col.Address).ColumnWidth = Col.ColumnWidth
Next Col
For Each Row In MasterRngR
Sht.Range(Row.Address).RowHeight = Row.RowHeight
Next Row
ActiveSheet.PageSetup.Zoom = MasterRngZ
End If
End If

Next Sht

End Sub


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Runtime Error 1004 Unable to set the top property of the picture c JB Bates[_2_] Excel Discussion (Misc queries) 1 March 3rd 10 08:04 PM
Error 1004: Unable to get the axis property Ana via OfficeKB.com Charts and Charting in Excel 1 June 24th 09 11:47 AM
Run Time Error 1004 Unable to set hidden property Lester Lee Excel Programming 3 July 22nd 04 03:31 AM
Run-time Error '1004' Unable to get the findnext property... Tom Ogilvy Excel Programming 0 July 12th 04 04:27 PM
Zoom property error Luis Excel Programming 1 October 17th 03 04:58 PM


All times are GMT +1. The time now is 01:25 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright 2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"