Hi,
I've been trying to hide certain columns based on the value of cells in the 2nd row.
I have tried the following code, but for some reason it won't hide anything. Protection is not an issue, all sheets are unprotected prior to the running of this code. To state the blindingly obvious myself: there are cells in the 2nd row with "Act." or "Plan", respectively.
Additionally, I also want to hide the row/column headings etc. in all sheets:
Though I doubt whether it is strictly neccesary to do this for each sheet, even when I try it like this the headings in one sheet still remain visible. This problem only occurs in this one sheet, and only for the headings; gridlines and formulabar are hidden.
Any help would be greatly appreciated
(Also posted on Ozgrid.com)
Junk
I've been trying to hide certain columns based on the value of cells in the 2nd row.
I have tried the following code, but for some reason it won't hide anything. Protection is not an issue, all sheets are unprotected prior to the running of this code. To state the blindingly obvious myself: there are cells in the 2nd row with "Act." or "Plan", respectively.
Code:
Worksheets("Growth").Activate
For a = 1 To 34
If Cells(2, a) = "Act." Then
Columns(a).EntireColumn.Hidden = True
End If
Next a
Worksheets("VOP").Activate
For b = 1 To 34
If Cells(2, b) = "Plan" Then
Columns(b).EntireColumn.Hidden = True
End If
Next b
Additionally, I also want to hide the row/column headings etc. in all sheets:
Code:
For Each sh In ThisWorkbook.Worksheets
ActiveWindow.DisplayHeadings = False
ActiveWindow.DisplayGridlines = False
Application.DisplayFormulaBar = False
Next sh
Though I doubt whether it is strictly neccesary to do this for each sheet, even when I try it like this the headings in one sheet still remain visible. This problem only occurs in this one sheet, and only for the headings; gridlines and formulabar are hidden.
Any help would be greatly appreciated
(Also posted on Ozgrid.com)
Junk