Results 1 to 10 of 10

End sub/with problem

Threaded View

dalewms2 End sub/with problem 10-13-2011, 02:09 PM
tigeravatar Re: End sub/with problem 10-13-2011, 02:49 PM
6StringJazzer Re: End sub/with problem 10-13-2011, 02:51 PM
Whizbang Re: End sub/with problem 10-13-2011, 02:57 PM
dalewms2 Re: End sub/with problem 10-13-2011, 03:11 PM
Whizbang Re: End sub/with problem 10-13-2011, 03:23 PM
dalewms2 Re: End sub/with problem 10-13-2011, 03:59 PM
Whizbang Re: End sub/with problem 10-13-2011, 04:50 PM
dalewms2 Re: End sub/with problem 10-13-2011, 04:53 PM
Whizbang Re: End sub/with problem 10-13-2011, 05:02 PM
  1. #1
    Forum Contributor
    Join Date
    08-08-2011
    Location
    Jacksonville, Florida
    MS-Off Ver
    Excel 2007
    Posts
    123

    End sub/with problem

    If I end the code with End Sub I get an error message that the program was expecting End With. When I use End With the program was expecting End Sub.

    Also within the following code can someone tell me exactly and only which lines to take out so the macro will stop counting empty cells. I only need to delete duplicate rows.

    Sub DeleteDuplicateEntries()
       Dim rClMain As Range
       Dim rClDupe As Range
       Dim rCheck
       Dim N As Long
       Application.ScreenUpdating = False
       N = 0
           'currently starts in A2 down,adjust to your data
       Set rCheck = Range(Cells(2, 1), Cells(Rows.Count, 1).End(xlUp))
       For Each rClMain In rCheck
            '1st loop - (to speed things up ignore any empty cells)
           If rClMain <> Empty Then
               For Each rClDupe In rCheck
                    '2nd loop - compare non-empty rClDupe values
                    'and clear contents if it's a duplicated value
                   If rClDupe <> Empty And _
                   rClDupe.Value = rClMain.Value And _
                   rClDupe.Address <> rClMain.Address Then
                       rClDupe.EntireRow.Delete
                       N = N + 1
                   End If
               Next rClDupe
           End If
       Next
       Application.ScreenUpdating = True
       MsgBox "There were " & N & " duplicated entries deleted"
    End Sub
    Last edited by dalewms2; 10-13-2011 at 03:10 PM.

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