+ Reply to Thread
Results 1 to 4 of 4

Why formula wont work over multiple worksheets?

  1. #1
    Forum Contributor
    Join Date
    02-13-2013
    Location
    Columbia, SC
    MS-Off Ver
    Excel 2010
    Posts
    217

    Why formula wont work over multiple worksheets?

    Can anyone see why this formula does not work across multiple worksheets?

    Sub RemoveDupe()
    Dim ws As Worksheet
    Dim rCell As Range
    Dim rRange As Range
    Dim lCount As Long
    For Each ws In Worksheets

    Set rRange = Range("B1", Range("B" & Rows.Count).End(xlUp))
    lCount = rRange.Rows.Count

    For lCount = lCount To 1 Step -1
    With rRange.Cells(lCount, 1)
    If WorksheetFunction.CountIf(rRange, .Value) > 1 Then
    .EntireRow.Delete
    End If
    End With
    Next lCount
    Next ws
    End Sub

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Why formula wont work over multiple worksheets?

    Change
    Please Login or Register  to view this content.
    To
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    02-13-2013
    Location
    Columbia, SC
    MS-Off Ver
    Excel 2010
    Posts
    217

    Re: Why formula wont work over multiple worksheets?

    That gives me an error: "Method 'Range' of object '_Worksheet' failed

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Why formula wont work over multiple worksheets?

    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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