Posts by nicoautoxp

    I indeed had a error in the initial code.
    After some trail and error i got my inital setup working using the following.

    Code
    If Not Intersect(Target, Columns(4)) Is Nothing Then
            If Target.Text = Blank Then
                Columns("F").EntireColumn.Hidden = True
            Else
                Columns("F").EntireColumn.Hidden = False
            End If
        End If

    However the method you suggested using "Target.value" also works. Thanks for the help!

    Hi,

    I'm trying to write VBA code so that when the cells in column D are empty, the columns E to Z are hidden. When something is written in the cell the columns should unhide.

    Hiding the columns has already works, but unhiding doesn't seem to work.

    Anybody that can help with my problem?

    Code
    Private Sub Worksheet_Change(ByVal Target As Range)
        If Not Intersect(Target, Columns(5)) Is Nothing Then
            If Target.Text = Blank Then
                Columns("I").EntireColumn.Hidden = True
            ElseIf Target.Text = NotBlank Then
                Columns("I").EntireColumn.Hidden = False
            End If
        End If
    End Sub