Consulting

Results 1 to 3 of 3

Thread: Delete Hidden Columns

  1. #1
    VBAX Regular
    Joined
    Jul 2004
    Location
    Surrey, B.C.
    Posts
    8
    Location

    Delete Hidden Columns

    I need to delete all the hidden columns within a worksheet using vba.

    This is probably an easy one for all of you. I know I have seen the answer somewhere, but I'm unable to find it. I tried to figure it on my own with no luck.

    Thanks in advance,

    Darlene

  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Hi,
    Try the following
    MD

    Sub DelHidden()
    For i = 1 To ActiveSheet.UsedRange.Columns.Count
        If Columns(i).Hidden = True Then
        Debug.Print i
            Columns(i).Delete
            i = i - 1
        End If
    Next
    End Sub

  3. #3
    VBAX Regular
    Joined
    Jul 2004
    Location
    Surrey, B.C.
    Posts
    8
    Location
    Thanks MD, it works great!

    Darlene

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •