S
Stephen
Hi Folks,
I have a workbook with one sheet for each month. Depending on the month
there are either 4 or 5 weeks so my columns N can be hidden in a 4 week
month. In order to protect formulas and print area, I have protected each
sheet in the workbook and can autofit the contents of all sheets via a macro
but everytime I try to select cols N and hide them it takes the entire
sheet and hides my contents.
Here is the code I'm working with.
Private Sub Workbook_Open()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Protect Password:="###", AllowFormattingCells:=True,
AllowFormattingColumns:=True
ws.Columns("A:V").AutoFit
Range("B1").Select
Next ws
Sheets("January").Select
Columns("N").Select
Selection.EntireColumn.Hidden = True
Range("B1").Select
This latest attempt won't even autofit before it hides my January sheet. I
have tried moving the Range Select after the autofit but before the next col
selection, and have even tried moving the col hide event to the worksheet
itself under the active event. Nothing I try seems to work. Please help!
I have a workbook with one sheet for each month. Depending on the month
there are either 4 or 5 weeks so my columns N can be hidden in a 4 week
month. In order to protect formulas and print area, I have protected each
sheet in the workbook and can autofit the contents of all sheets via a macro
but everytime I try to select cols N and hide them it takes the entire
sheet and hides my contents.
Here is the code I'm working with.
Private Sub Workbook_Open()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Protect Password:="###", AllowFormattingCells:=True,
AllowFormattingColumns:=True
ws.Columns("A:V").AutoFit
Range("B1").Select
Next ws
Sheets("January").Select
Columns("N").Select
Selection.EntireColumn.Hidden = True
Range("B1").Select
This latest attempt won't even autofit before it hides my January sheet. I
have tried moving the Range Select after the autofit but before the next col
selection, and have even tried moving the col hide event to the worksheet
itself under the active event. Nothing I try seems to work. Please help!