+ Reply to Thread
Results 1 to 3 of 3

Delete is multiple conditions are met

  1. #1
    Registered User
    Join Date
    10-05-2010
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    23

    Delete is multiple conditions are met

    Hello,

    I'm quite a novice here. I'm trying to delete rows where column C contains specific text in some instances. In other cases I am trying to delete rows where specific text is found in column C AND column M contains the year 2009 (in format dd-mm-yyyy).

    The code I'm working with so far is as follows:

    'This part is working OK
    Sub DataProcess()

    DataSheetProcess Macro

    Sheets("Data").Select

    LastRow = Cells(Rows.Count, 1).End(xlUp).Row

    'start incrementing
    For y = LastRow To 2 Step -1

    'If Cells(y, "C").Value = "SANS" Then Rows(y).EntireRow.Delete
    'End If

    'If Cells(y, "C").Value = "NOVA" Then Rows(y).EntireRow.Delete '
    'End If

    'The following is not working correctly

    If Cells(y, "C").Value = "DINERS MIGRATED MERCHANTS" AND EntryDate.Cells(y, "M").Value = 2009 Then
    Rows(y).EntireRow.Delete
    End If

    Next y
    End If

    End Sub

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,482

    Re: Delete is multiple conditions are met

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here

  3. #3
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,482

    Re: Delete is multiple conditions are met

    Once you have complete the first request....

    To best describe or illustrate your problem you would be better off attaching a dummy workbook, the workbook should contain the same structure and some dummy data of the same type as the type you have in your real workbook - so, if a cell contains numbers & letters in this format abc-123 then that should be reflected in the dummy workbook.

    If needed supply a before and after sheet in the workbook so the person helping you can see what you are trying to achieve.

    Doing this will ensure you get the result you need!

+ 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