Hi,
I have the macro below and it works ok, however it currently looks at all the worksheets in the workbook and I would like to exclude the last 5 worksheets - is there a way to do this please?
Thanks
Karen
Sub Hide_Columns_Containing_Value()
Application.ScreenUpdating = False
Dim WS As Worksheet
Dim X As Range
For Each WS In ThisWorkbook.Worksheets
WS.Activate
Cells.Select
Selection.EntireRow.Hidden = False
Selection.EntireColumn.Hidden = False
For Each X In ActiveSheet.UsedRange.Columns(1).Cells
If X.Value = "False" Then
X.EntireRow.Hidden = True
ActiveSheet.Range("A1").Select
End If
Next X
Next WS
Application.ScreenUpdating = True
End Sub
I have the macro below and it works ok, however it currently looks at all the worksheets in the workbook and I would like to exclude the last 5 worksheets - is there a way to do this please?
Thanks
Karen
Sub Hide_Columns_Containing_Value()
Application.ScreenUpdating = False
Dim WS As Worksheet
Dim X As Range
For Each WS In ThisWorkbook.Worksheets
WS.Activate
Cells.Select
Selection.EntireRow.Hidden = False
Selection.EntireColumn.Hidden = False
For Each X In ActiveSheet.UsedRange.Columns(1).Cells
If X.Value = "False" Then
X.EntireRow.Hidden = True
ActiveSheet.Range("A1").Select
End If
Next X
Next WS
Application.ScreenUpdating = True
End Sub