Consulting

Results 1 to 3 of 3

Thread: VBA Macros Help

  1. #1
    VBAX Regular
    Joined
    Oct 2008
    Posts
    28
    Location

    Cool VBA Macros Help

    Hai

    I am New to VB Macros . I want to Check the Duplicate Value in the Excel Value Using Macro VB editor

    Eg:

    If the 1 St Row Contains Name as " VB" and the Value For Vb is 30 ( Name in the 1 St Column and Value in the 3 rd Column) and
    2 nd Row Contains the Same Name "VB" and the Value for this is 20. (Name in the 1 st Column and Value in the 3rd Column)

    I want to Remove the Duplicate Name and I want the output like this

    VB and the Value is 50 (30+20)

    Can Anyone Tell How can I Get this? Can AnyOne Send me the Code for Adding the Value After Checks the Duplicate Name

    Thanks in Advance

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    Public Sub ProcessData()
    Dim LastRow As Long
    Dim iRow As Long
    Dim i As Long

    With ActiveSheet

    LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
    For i = LastRow To 1 Step -1

    iRow = Application.Match(.Cells(i, "A").Value, .Columns(1), 0)
    If iRow <> i Then

    .Cells(iRow, "C").Value = .Cells(iRow, "C").Value + .Cells(i, "C").Value
    .Rows(i).Delete
    End If
    Next i
    End With

    End Sub
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Regular
    Joined
    Oct 2008
    Posts
    28
    Location
    Can I have Ur Mail ID?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •