+ Reply to Thread
Results 1 to 10 of 10

Hide duplicate rows

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    03-15-2007
    Location
    AL, USA
    MS-Off Ver
    2007
    Posts
    174
    Quote Originally Posted by VBA Noob
    Maybe this code will help

    How to add code

    Option Explicit
     
    Sub DeleteDups()
         
        Dim x               As Long
        Dim LastRow         As Long
         
        LastRow = Range("B65536").End(xlUp).Row
        For x = LastRow To 1 Step -1
            If Application.WorksheetFunction.CountIf(Range("B1:B" & x), Range("B" & x).Text) > 1 Then
                Range("B" & x).EntireRow.Delete
            End If
        Next x
         
    End Sub
    VBA Noob
    So what if I needed to only hide the duplicate rows temproarily?

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Try

    Option Explicit
     
    Sub DeleteDups()
         
        Dim x               As Long
        Dim LastRow         As Long
         
        LastRow = Range("B65536").End(xlUp).Row
        For x = LastRow To 1 Step -1
            If Application.WorksheetFunction.CountIf(Range("B1:B" & x), Range("B" & x).Text) > 1 Then
                Range("B" & x).EntireRow.Hidden = True
            End If
        Next x
         
    End Sub

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Forum Contributor
    Join Date
    03-15-2007
    Location
    AL, USA
    MS-Off Ver
    2007
    Posts
    174
    Quote Originally Posted by VBA Noob
    Try

    Option Explicit
     
    Sub DeleteDups()
         
        Dim x               As Long
        Dim LastRow         As Long
         
        LastRow = Range("B65536").End(xlUp).Row
        For x = LastRow To 1 Step -1
            If Application.WorksheetFunction.CountIf(Range("B1:B" & x), Range("B" & x).Text) > 1 Then
                Range("B" & x).EntireRow.Hidden = True
            End If
        Next x
         
    End Sub

    VBA Noob

    Works like a charm! thanks a million!

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    No problem.

    Glad I could help.

    PS. Please read forum rules below and remember to start your own thread

    VBA Noob

  5. #5
    Forum Contributor
    Join Date
    03-15-2007
    Location
    AL, USA
    MS-Off Ver
    2007
    Posts
    174
    Quote Originally Posted by VBA Noob

    PS. Please read forum rules below and remember to start your own thread
    I did, or at least i thought i did. what other thread did i steal, and how did i manage to do so?

  6. #6
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    You replied to a thread on how to delete rows.

    So what if I needed to only hide the duplicate rows temproarily?
    VBA Noob

+ 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