PC Review


Reply
Thread Tools Rate Thread

How to Change Worksheet Properties

 
 
=?Utf-8?B?RGV2RGFuaWVs?=
Guest
Posts: n/a
 
      21st Feb 2007
I have:
A macro to change page setup properties. The macro appears to run but
doesn't change the properties.

I want:
The macro needs to work if the names or number of worksheets changes (there
will always be a worksheet "Main" that begins with the wrong page setup
properties).
1. To change the print quality of all worksheets to 600 dpi.
2. To change the Fit to Page property of the "Main" worksheet to False.

Code snippet:
'Change print quality of all sheets to 600 dpi

ActiveWorkbook.Sheets.Select

With ActiveSheet.PageSetup
.PrintQuality = 600
End With

'Change the FitToPagesTall property on the Main worksheet to False

Sheets("Main").Select

With ActiveSheet.PageSetup
.FitToPagesWide = 1
.FitToPagesTall = False
End With

Any suggestions?
 
Reply With Quote
 
 
 
 
=?Utf-8?B?VG9tIE9naWx2eQ==?=
Guest
Posts: n/a
 
      21st Feb 2007
ActiveWorkbook.Sheets.Select

With ActiveSheet.PageSetup
.PrintQuality = 600
End With

You select all sheets, then only change properties on the activesheet.

for the most part, VBA doesn't not support grouped sheets. Loop through the
sheets and make you setting to each sheet individually.

--
Regards,
Tom Ogilvy


"DevDaniel" wrote:

> I have:
> A macro to change page setup properties. The macro appears to run but
> doesn't change the properties.
>
> I want:
> The macro needs to work if the names or number of worksheets changes (there
> will always be a worksheet "Main" that begins with the wrong page setup
> properties).
> 1. To change the print quality of all worksheets to 600 dpi.
> 2. To change the Fit to Page property of the "Main" worksheet to False.
>
> Code snippet:
> 'Change print quality of all sheets to 600 dpi
>
> ActiveWorkbook.Sheets.Select
>
> With ActiveSheet.PageSetup
> .PrintQuality = 600
> End With
>
> 'Change the FitToPagesTall property on the Main worksheet to False
>
> Sheets("Main").Select
>
> With ActiveSheet.PageSetup
> .FitToPagesWide = 1
> .FitToPagesTall = False
> End With
>
> Any suggestions?

 
Reply With Quote
 
=?Utf-8?B?VmVyZ2VsIEFkcmlhbm8=?=
Guest
Posts: n/a
 
      21st Feb 2007
If I understand correctly, you want to apply the settings to all sheets.
Try this

Dim sht As Worksheet
For Each sht In ActiveWorkbook.Sheets
With sht.PageSetup
.PrintQuality = 600
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
Next sht


"DevDaniel" wrote:

> I have:
> A macro to change page setup properties. The macro appears to run but
> doesn't change the properties.
>
> I want:
> The macro needs to work if the names or number of worksheets changes (there
> will always be a worksheet "Main" that begins with the wrong page setup
> properties).
> 1. To change the print quality of all worksheets to 600 dpi.
> 2. To change the Fit to Page property of the "Main" worksheet to False.
>
> Code snippet:
> 'Change print quality of all sheets to 600 dpi
>
> ActiveWorkbook.Sheets.Select
>
> With ActiveSheet.PageSetup
> .PrintQuality = 600
> End With
>
> 'Change the FitToPagesTall property on the Main worksheet to False
>
> Sheets("Main").Select
>
> With ActiveSheet.PageSetup
> .FitToPagesWide = 1
> .FitToPagesTall = False
> End With
>
> Any suggestions?

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Change Chart Properties for Multiple Chart Shts using a Worksheet KUMPFfrog Microsoft Excel Charting 0 22nd Jul 2009 11:01 PM
Change the properties of the worksheet row or column header bars FSHOTT Microsoft Excel Misc 6 29th Mar 2009 04:35 PM
Change worksheet, two trigger cells on one worksheet, only one triggers correctly; using two If statements, do I need End If? Harold Good Microsoft Excel Programming 3 25th Mar 2009 03:37 PM
How to get worksheet change code to work on protected worksheet? StargateFan Microsoft Excel Programming 4 16th Feb 2009 02:40 PM
Change Worksheet Button Caption on Worksheet.Activate =?Utf-8?B?TWlrZVp6?= Microsoft Excel Programming 1 7th Dec 2006 06:01 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:35 AM.