+ Reply to Thread
Results 1 to 4 of 4

If then Statement not working

  1. #1
    Forum Contributor
    Join Date
    10-23-2003
    Posts
    141

    If then Statement not working

    Hi,

    Does any one have suggestions for a macro that will look at column G and if the cell does not contain an "A" or "L", delete the entire row. The Macro I am currently running is not working. Any help would be greatly appreciated!

    Thanks

  2. #2
    Registered User
    Join Date
    03-18-2005
    Posts
    5
    Here's how I would delete a row. Just update curRow with the row number you want to delete.


    RowSel = curRow & ":" & curRow
    ActiveSheet.Range(RowSel).Delete Shift:=xlDown

  3. #3
    Forum Contributor
    Join Date
    03-03-2005
    Posts
    316
    try:

    Sub DeleteCondition()
    lastrw = [d65536].End(xlUp).Row
    For x = lastrw To 1 Step -1
    If Not Cells(x, "d") Like "*A*" Xor Not Cells(x, "d") Like "*L*" Then
    Cells(x, "d").EntireRow.Delete
    End If
    Next

    End Sub

    -DM

  4. #4
    Forum Contributor
    Join Date
    10-23-2003
    Posts
    141
    Thanks!!!!

    Your suggestion worked great!

+ Reply to Thread

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