Help with a button on a spreadsheet
Posted by Anita on February 12, 2002 1:18 PM
I have a command button that is on a "protected/shared" workbook - this shared workbook has a password assigned to it.
I'm trying to define a print area that is not consecutive via a macro so I've defined the code as follows:
Private Sub CommandButton1_Click()
Call PrintWorksheet
End Sub
Sub PrintWorksheet()
'
' PrintWorksheet Macro
' Macro recorded 2/12/2002 by Anita Grimes
'
'
Columns("A:B").Select
Selection.EntireColumn.Hidden = True
Columns("F:F").Select
Selection.EntireColumn.Hidden = True
ActiveWindow.SmallScroll ToRight:=5
Columns("P:P").Select
Selection.EntireColumn.Hidden = True
Columns("R:R").Select
Selection.EntireColumn.Hidden = True
Columns("U:U").Select
Selection.EntireColumn.Hidden = True
Range("C1:AB51").Select
ActiveSheet.PageSetup.PrintArea = "$C$1:$AB$51"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Cells.Select
Range("C1").Activate
Selection.EntireColumn.Hidden = False
End Sub
When I attempt to execute this button from my workbook, I get the message: "Unable to set the Hidden Property of the Range class".
I think this may have something to do with the fact that the workbook is protected and shared but I'm not quite sure.
Any ideas anyone?
Thanks in advance!
Anita