Private Const FirstRow = 1 ' The row to check
Public Sub HideNameDateAge()
' Hide "Name", "Date" and "Age" columns
HideColumns True, "Name", "Date", "Age"
End Sub
Public Sub ShowNameDateAge()
' Show "Name" and "Date" columns
HideColumns False, "Name", "Date"
End Sub
Public Sub HideColumns(hideColumn As Boolean, ParamArray columnHeaders() As Variant)
Dim lastCol As Long
Dim thisCol As Long
Dim columnName As Variant
' Find the last column
lastCol = Cells(FirstRow, Columns.Count).End(xlToLeft).Column
' Look at all columns
For thisCol = 1 To lastCol
' Look at the names we were passed
For Each columnName In columnHeaders
' Check if it matches
If Cells(FirstRow, thisCol).Value = columnName Then
' Show / Hide as appropriate
Cells(FirstRow, thisCol).EntireColumn.Hidden = hideColumn
End If
Next columnName
Next thisCol
End Sub