+ Reply to Thread
Results 1 to 5 of 5

vba help to delete the column till values met desired header

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    07-21-2011
    Location
    Bangalore,India
    MS-Off Ver
    Excel 2007,2010,2016
    Posts
    695

    Re: vba help to delete the column till values met desired header

    Sir Its works Perfectly !!! I want one modification while run this code i want add this action( replace header value only of B1(order release date) as (commitment release date) in your code rest of all remain same....thanks alot sir

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: vba help to delete the column till values met desired header

    Maybe:

    Sub breadwinnerZZz()
    Dim i As Long
    Application.ScreenUpdating = False
    For i = ActiveSheet.UsedRange.Columns.count To 1 Step -1
        Select Case Cells(1, i).Value
            Case Is = "COMMITED SERVICE END"
                If Cells(1, i - 1) <> "COMMITED SERVICE COUNT" Then
                    Cells(1, i - 1).EntireColumn.Delete
                End If
            Case Is = "COMMITED SERVICE COUNT"
                If Cells(1, i - 1) <> "COMMITED SERVICE RATE" Then
                    Cells(1, i - 1).EntireColumn.Delete
                End If
            Case Is = "COMMITED SERVICE RATE"
                If Cells(1, i - 1) <> "COMMITED SERVICE ZONE" Then
                    Cells(1, i - 1).EntireColumn.Delete
                End If
            Case Is = "COMMITED SERVICE ZONE"
                If Cells(1, i - 1) <> "COMMITED SERVICE START" Then
                    Cells(1, i - 1).EntireColumn.Delete
                End If
            Case Is = "COMMITED SERVICE START"
                If Cells(1, i - 1) <> "COMMITED SERVICE" Then
                    Cells(1, i - 1).EntireColumn.Delete
                End If
            Case Is = "COMMITED SERVICE"
                If Cells(1, i - 1) <> "ORDER RELEASE DATE" Then
                    Cells(1, i - 1).EntireColumn.Delete
                Else
                    Cells(1, i - 1) = "COMMITMENT RELEASE DATE"
                End If
        End Select
    Next i
    Application.ScreenUpdating = True
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Delete Column only after certain Row with Specified Header
    By Pho6 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 09-16-2013, 02:36 PM
  2. [SOLVED] Delete all cell content in column except for desired string
    By SammieRae in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-23-2013, 06:22 PM
  3. Delete every alternate columns till the last data in the row from column G
    By andywsw in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-11-2012, 11:59 PM
  4. SUM values in a column till you reach a flag in another column- Urgent
    By naveen.vinukonda@gmail.com in forum Excel General
    Replies: 2
    Last Post: 02-18-2005, 10:06 AM
  5. [SOLVED] SUM values in a column till you reach a flag in another column- Urgent
    By naveen.vinukonda@gmail.com in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-18-2005, 10:06 AM

Tags for this Thread

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