+ Reply to Thread
Results 1 to 2 of 2

Easy problem

Hybrid View

bradyj2 Easy problem 03-01-2011, 02:32 PM
NBVC Re: Easy problem 03-01-2011, 02:34 PM
  1. #1
    Registered User
    Join Date
    01-18-2011
    Location
    Dublin
    MS-Off Ver
    Excel 2007
    Posts
    2

    Easy problem

    Hi all,

    The macro below deletes all duplicate rows by checking Column A for duplicate entries. It works fine for ordinary numbers but it wont work for for times and dates. The entries in column A are in the format dd/mm/yyyy hh:mm:ss. How to I modify the code to do this. I tried declaring the variables As date but it doesn't work. Any ideas please?

    Sub DeleteDups()

    Dim x As Long
    Dim LastRow As Long

    LastRow = Range("A65536").End(xlUp).Row
    For x = LastRow To 1 Step -1
    If Application.WorksheetFunction.CountIf(Range("A1:A" & x), Range("A" & x).Text) > 1 Then
    Range("A" & x).EntireRow.Delete
    End If
    Next x

    End Sub

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Easy problem

    Welcome to the forum,

    Please read over the forum rules and amend your post to comply with them.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

+ 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