Need help if anyone can provide it. I'm trying to write a Macro where i can hide columns based on a cell value. The issue I'm having is trying to figure out how to construct it in a manner where I can have the macro work based on multiple cell values as well as work throughout the entire workbook that's has over 400 tabs. what I have only works with one cell value and only on the current worksheet.
here is the VBA code I have:
I'm fairly new to Macros so id like to know what I'm doing wrong, how to correct it to achieve hiding columns based on multiple cell values and work for the entire workbook, and an explanation of how you got it to work if possible. Your time and help is greatly appreciated
here is the VBA code I have:
VBA Code:
Sub HideCols()
Dim cell As Range
For Each cell In ActiveWorkbook.ActiveSheet.Rows("8").Cells
If cell.Value = "X" Then
cell.EntireColumn.Hidden = True
End If
Next cell
End Sub
I'm fairly new to Macros so id like to know what I'm doing wrong, how to correct it to achieve hiding columns based on multiple cell values and work for the entire workbook, and an explanation of how you got it to work if possible. Your time and help is greatly appreciated
Last edited by a moderator: