Tuesday, 20 November 2012

Hide Column Meeting a Criteria (in Excel)

Sub HideColumnMeetingCriteria()
    
     '
     ' Hide Column Meeting a Criteria by RG
     '
    Application.ScreenUpdating = False
    
On Error Resume Next

    With ActiveSheet
        For Each cell In Range("H1:IT1")
            If cell.Value Like "*Perm*" Then
                cell.EntireColumn.Hidden = False
            Else
                cell.EntireColumn.Hidden = True
            End If
        Next
    End With
    
    Application.EnableEvents = True
    
End Sub

No comments:

Post a Comment