Results 1 to 9 of 9

VBA for combined rows with similar text and sum

Threaded View

  1. #2
    Valued Forum Contributor abduljaleel.mca's Avatar
    Join Date
    02-13-2013
    Location
    Chennai, India
    MS-Off Ver
    MS 365 Business
    Posts
    326

    Re: VBA for combined rows with similar text and sum

    Try this macro.
    Sub combine_Data()
    
    Dim strDataRange As Range
    Dim keyRange As Range
    Dim sum1, sum2 As Integer
    LRA = Cells(Rows.Count, "F").End(xlUp).Row
    Set strDataRange = Range("A2:P" & LRA)
    Set keyRange = Range("F1")
    strDataRange.Sort Key1:=keyRange, Header:=xlYes
    Range("A1").Select
    
    For i = 2 To Cells(Rows.Count, "F").End(xlUp).Row
    If (Cells(i, 6).Value = Cells(i + 1, 6).Value) And Cells(i, 6).Value <> "" Then
    sum1 = sum1 + Cells(i, 14) + Cells(i + 1, 14)
    sum2 = sum2 + Cells(i, 16) + Cells(i + 1, 16)
    Cells(i, 14) = sum1
    Cells(i, 16) = sum2
    Rows(i + 1 & ":" & i + 1).Delete
    i = i - 1
    sum1 = 0
    sum2 = 0
    End If
    Next i
    
    End Sub
    Last edited by abduljaleel.mca; 07-28-2016 at 07:01 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Combined text and date
    By nagesh.tvsr in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-07-2015, 02:17 AM
  2. [SOLVED] SUMIF with combined rows
    By slacknoise in forum Excel General
    Replies: 1
    Last Post: 06-19-2014, 12:38 PM
  3. Combined vlookup and if contains text within text function
    By mika6177 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 05-10-2014, 07:20 PM
  4. Replies: 1
    Last Post: 05-10-2012, 11:33 AM
  5. if or vlookup help (combined columns or rows in one)
    By NV32 in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 07-03-2009, 06:55 AM
  6. Text and formula combined?
    By brendan76 in forum Excel General
    Replies: 2
    Last Post: 02-12-2008, 06:13 AM
  7. use combined text to call a Name
    By Hammer_757 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-03-2006, 01:20 PM

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