Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Change Chart Properties for Multiple Chart Shts using a Worksheet | Charts and Charting in Excel | |||
Change the properties of the worksheet row or column header bars | Excel Discussion (Misc queries) | |||
change properties on | Excel Programming | |||
Change properties of a combobox with VBA | Excel Programming | |||
Change ComboBox properties in VBA? | Excel Programming |