+ Reply to Thread
Results 1 to 3 of 3

Delete Rows based on criteria in Column A (not working)

  1. #1
    Registered User
    Join Date
    10-04-2005
    Location
    NYC <--> Lagos
    Posts
    24

    Delete Rows based on criteria in Column A (not working)

    I am trying to put additional functionality in this code to delete rows with "3/25/2005" or "12/31/2004" in column A.

    This doesn't work, yet it doesn't give any errors.
    When i check my sheet, it deletes duplicate rows but not the rows with "3/25/2005" or "12/31/2004".
    Please can anyone take a look? Thanks

    Please Login or Register  to view this content.

  2. #2
    Kleev
    Guest

    RE: Delete Rows based on criteria in Column A (not working)

    I wonder if you don't need to put the dates in between # signs, ie #3/25/2005#

    "Mslady" wrote:

    >
    > I am trying to put additional functionality in this code to delete rows
    > with "3/25/2005" or "12/31/2004" in column A.
    >
    > This doesn't work, yet it doesn't give any errors.
    > When i check my sheet, it deletes duplicate rows but not the rows with
    > "3/25/2005" or "12/31/2004".
    > Please can anyone take a look? Thanks
    >
    >
    > Code:
    > --------------------
    >
    > 'DELETE DUPLICATE ROWS AND DELETE ROWS WITH CRITERIA
    > Dim i As Long
    > Dim cursheet As Worksheet
    > Set cursheet = Worksheets("DataTable")
    > For i = cursheet.Cells(Rows.Count, "A").End(xlUp).Row To 2 Step -1
    > If WorksheetFunction.CountIf(cursheet.Range(cursheet.Cells(2, 1), cursheet.Cells(i, 1)), cursheet.Cells(i, 1)) > 1 Or _
    > Cells(i, "A").Value = "3/25/2005" Or _
    > Cells(i, "A").Value = "12/31/2004" Then
    > cursheet.Cells(i, 1).EntireRow.Delete
    > End If
    > Next i
    >
    > --------------------
    >
    >
    > --
    > Mslady
    > ------------------------------------------------------------------------
    > Mslady's Profile: http://www.excelforum.com/member.php...o&userid=27776
    > View this thread: http://www.excelforum.com/showthread...hreadid=480242
    >
    >


  3. #3
    Registered User
    Join Date
    10-04-2005
    Location
    NYC <--> Lagos
    Posts
    24
    Hi Kleev,
    I tried again, still no luck.

    It works when i put it in my module, but not when i put it in my sheet. Any ideas?

+ 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