Results 1 to 4 of 4

Delete entire Columns based on different Headers (Array)

Threaded View

  1. #1
    Registered User
    Join Date
    04-11-2013
    Location
    RC
    MS-Off Ver
    Excel 2007
    Posts
    10

    Delete entire Columns based on different Headers (Array)

    Hi,

    Trying to basically have certain Columns deleted based on the Header's title.

    This is my code so far, but I can't get it to work.

    Sub DeleteHeaderColumn()
    
    Dim FindThis As String
    Dim FoundIt As Range
    
    Do
    FindThis = (Array("Batch", "Straps", "Straps Verified"))
    Rows("1:1").Select
    Set FoundIt = Rows(1).Find(What:=FindThis, Lookat:=xlPart, MatchCase:=False)
    If FountIt Is Nothing Then Exit Do
    
        FoundIt.EntireColumn.Delete Shift:=xlToLeft
    
    Loop
    
    End Sub
    Basically any Columns from A:Z on the 1st row with Headers titled "Batch", "Straps", "Straps Verified" should be deleted but, VBA keeps skipping them.

    I know I'm missing something.

    Any help would be greatly appreciated, thanks.
    Last edited by WITJ; 05-13-2013 at 02:15 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1