Results 1 to 3 of 3

VBA to delete rows

Threaded View

mannm4 VBA to delete rows 02-01-2010, 02:31 PM
Leith Ross Re: VBA to delete rows 02-01-2010, 02:48 PM
Richard Buttrey Re: VBA to delete rows 02-01-2010, 02:50 PM
  1. #1
    Registered User
    Join Date
    02-01-2010
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    4

    VBA to delete rows

    I am trying to write a macro that deletes rows based on certain criteria. I have rows with the word "Summary:" in it that I want to keep (no problem). My issue is that i then have rows that all begin with "Application:". What comes after that is different (i.e. Application: Start, Application: End). I need help creating this wildcard search as I have tried with no succes. This is what I have so far:

    Sub A()
    Set objExcel = CreateObject("Excel.Application")
    objExcel.Visible = True
    
    Set objWorkbook = objExcel.Workbooks.Open("C:\Documents and Settings\MANNM4\Desktop\Copy of appt center (dec 2009)-test")
    i = 1
    
    Do Until objExcel.Cells(i, 1).Value = "Done"
        If objExcel.Cells(i, 1).Value <> "Summary:" And objExcel.Cells(i, 2).Value <> "Offered" Then
            Set objRange = objExcel.Cells(i, 1).EntireRow
            objRange.Delete
            i = i - 1
        End If
        i = i + 1
    Loop
    
    End Sub
    Last edited by Leith Ross; 02-01-2010 at 02:34 PM. Reason: Corrected Code Tags

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