Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default How to Change Worksheet Properties

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?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default How to Change Worksheet Properties

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?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default How to Change Worksheet Properties

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
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
Change Chart Properties for Multiple Chart Shts using a Worksheet KUMPFfrog Charts and Charting in Excel 0 July 22nd 09 11:01 PM
Change the properties of the worksheet row or column header bars FSHOTT Excel Discussion (Misc queries) 6 March 29th 09 04:35 PM
change properties on k2sarah Excel Programming 0 November 1st 06 02:24 PM
Change properties of a combobox with VBA leonidas[_12_] Excel Programming 0 June 20th 06 02:54 PM
Change ComboBox properties in VBA? [email protected] Excel Programming 2 January 20th 06 03:34 PM


All times are GMT +1. The time now is 02:10 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"