Results 1 to 5 of 5

VBA Grouping Concatenate best way to handle, based on data in column

Threaded View

  1. #1
    Registered User
    Join Date
    09-27-2011
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    10

    VBA Grouping Concatenate best way to handle, based on data in column

    Hi all,
    I have been working on a grouping of data in Column A based on data in column D. if the data in Column D matches next row in D then Concatenate data in column A and delete that line

    any help appreciated to steer me in right direction
    thanks regards Peter

    Data Sample.jpg




    My code so far

    Sub CommandButton2_Click()
    Dim x               As Integer
    Dim MyTimer         As Double
    x = MsgBox("This with now Group all Data IN Column A and Sheet1!", vbOKCancel)
    If x = 2 Then Exit Sub
    If x = 1 Then
    MsgBox (" Application.EnableEvents = False")
     'Application.EnableEvents = False
     
         Dim Lastrow As Long, r As Long
        Application.ScreenUpdating = False
        Lastrow = Range("A" & Rows.Count).End(xlUp).Row
      
      'status bar code loop
       ' For j = 1 To 50
        
        For r = Lastrow To 2 Step -1
            If Range("D" & r).Value = Range("D" & r - 1).Value Then
                Range("A" & r).Value = Range("A" & r - 1).Value & "_" & Range("A" & r).Value
                Rows(r).Delete xlShiftUp
            
            End If
            'status bar code line under
            ' Application.StatusBar = "Progress: " & r & " of " & Lastrow & ": " & Format(r / Lastrow, "0%")
        Next r
     
        ActiveSheet.UsedRange.Columns.AutoFit
        Application.ScreenUpdating = True
        Application.EnableEvents = True
        Application.StatusBar = False
     
     
     End If
     
     End Sub
    Attached Images Attached Images

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Concatenate Data based on column
    By dylanvv in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-15-2015, 05:34 PM
  2. Concatenate column of data based on interation value in other column
    By wheel1 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-11-2015, 07:32 PM
  3. [SOLVED] VBA macro Code for grouping based on column A
    By Dharani Suresh in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 05-05-2014, 04:41 AM
  4. [SOLVED] Concatenate row data in columns B-F based on duplicate value in column A
    By wolffia in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-20-2014, 10:03 AM
  5. Replies: 9
    Last Post: 12-13-2013, 07:40 PM
  6. Grouping into month based the data and inserting column
    By thisisgerald in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-07-2012, 06:35 AM
  7. Help! Grouping amounts in one column based on id on another column
    By explorart in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-17-2006, 04:12 PM

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