Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hello,
I am fairly new to all this macro stuff. I have a macro that keeps giving me an error only after I place protections on the sheets and workbook. The macro is triggered by a command button (commandButton1). The third page in my script is hidden, the other two are not. Ranges are defined on the first two and they print just fine. Third one has a formula which used to work but doesn't now. I have tried to figure out why it has gone awry, and failed. Any help would be appreciated. Here is the code: Private Sub CommandButton1_Click() ' Hide_Print_Unhide Macro ' Macro recorded 5/5/2006 by Robert Lizak ' Dim cell As Range Dim myPwd As String myPwd = "secret" Application.ScreenUpdating = False Sheets("Stats").PageSetup.PrintArea = "$A$1:$R$46" Sheets("Stats").PrintPreview Sheets("Equipment & Background").PageSetup.PrintArea = "$A$1:$F$46" Sheets("Equipment & Background").PrintPreview Sheets("Print Sheet").Active ActiveSheet.Unprotect Password:=myPwd Sheets("Print Sheet").Visible = True With Sheets("Print Sheet") For Each cell In .Range("A1:A712") If cell.Value = "" Then cell.EntireRow.Hidden = True Next cell .PrintPreview .Range("A1:A712").EntireRow.Hidden = False .Visible = False ActiveSheet.Protect Password:=myPwd End With Application.ScreenUpdating = True ' End Sub runtime error '438' Object doesn't support this property or method. -Robert Lizak- |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Print all charts in a workbook (multiple worksheets) | Charts and Charting in Excel | |||
Print multiple A5 pages on A4 paper | Excel Discussion (Misc queries) | |||
Should all pages in a workbook print in color? | Excel Discussion (Misc queries) | |||
Pivot Table macro to set print area and print details of drill down data | Excel Discussion (Misc queries) | |||
Macro to open print window and set to print entire workbook | Excel Discussion (Misc queries) |