Results 1 to 3 of 3

Macro SUM 2 Colums & Delete Row, but Works in 1 worksheet but in other WSheet Doesn't Work

Threaded View

feroguz Macro SUM 2 Colums & Delete... 11-08-2012, 04:30 PM
haripopuri Re: Macro SUM 2 Colums &... 11-08-2012, 04:41 PM
xladept Re: Macro SUM 2 Colums &... 11-08-2012, 05:10 PM
  1. #1
    Registered User
    Join Date
    06-06-2012
    Location
    Mexico
    MS-Off Ver
    Excel 2010
    Posts
    99

    Macro SUM 2 Colums & Delete Row, but Works in 1 worksheet but in other WSheet Doesn't Work

    Hi everyone!!

    Good afternoon!!

    I have this macro:

    Sub sumarizar_duplicados()
    
    Dim LR As Long, i As Long
    LR = Range("C" & Rows.Count).End(xlUp).Row
    
    Range("C4:C" & LR).Sort Key1:=Range("C4"), Order1:=xlAscending
    
        For i = LR To 2 Step -1
            If Cells(i, "C").Value = Cells(i - 1, "C").Value Then
                Cells(i - 1, "H").Value = Cells(i - 1, "H").Value + Cells(i, "H").Value
                Rows(i).Delete
            End If
        Next i
    
    End Sub
    And Works, but the information is incorrect, maybe it's a problem in the order..
    The purpose of the macro is to detect if there are duplicates values in column "B" and sum in the column "H"
    .. attach the file!!

    Thanks again!
    Best Regards!!

    captura.jpg
    Attached Files Attached Files

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