Hi,
I'd like to hide rows and/or columns based on some cell contents, after these contents are entered. I fill the cell contents with check-boxes by adding a cell-link from the check-box to a cell.
If the box is checked, the cell shows the value true.
If I want to do this based on one expression I use the VBA Code as follos:
Private Sub Worksheet_Change(ByVal Target As Range)
Application.ScreenUpdating = False
' Dim R As Range
' Set R = Application.Intersect (Target, Range("B7:B7"))
' If R Is Nothing Then Exit Sub
With ActiveSheet
For Each Cell In Range("C7")
If Cell.Value = "explicit" Then
Cell.EntireColumn("F").Hidden = True
Cell.EntireColumn("E").Hidden = True
Cell.EntireColumn("G").Hidden = False
Else
Cell.EntireColumn("G").Hidden = True
Cell.EntireColumn("E").Hidden = False
Cell.EntireColumn("F").Hidden = False
End If
Next
End With
Application.ScreenUpdating = True
End Sub
---
Now I'd like to add something like this:
With ActiveSheet
For Each Cell In Range("C11")
If Cell.Value = "true" Then
Cell.EntireColumn("I").Hidden = True
Else
Cell.EntireColumn("I").Hidden = False
End If
----
Unfortunately I don't know how (my last code might be totally wrong).
Please advise.