View Full Version : VBA Concatenate based on another cell value
wrightyrx7
03-16-2012, 11:51 AM
Hi all,
Please can you have a look at the spreadsheet i have attached. It has some example data and some more data of how i would want it to concatenate.
i have placed the data in the columns that the real data is on, on my spreadsheet.
Any help would be great.
Regards
Chris
Bob Phillips
03-16-2012, 01:02 PM
Sub ProcessData()
Dim lastrow As Long
Dim i As Long
With ActiveSheet
lastrow = .Cells(.Rows.Count, "D").End(xlUp).Row
For i = lastrow To 3 Step -1
If .Cells(i, "D").Value = .Cells(i - 1, "D").Value Then
.Cells(i - 1, "E").Value = .Cells(i - 1, "E").Value & "," & _
.Cells(i, "E").Value
.Rows(i).Delete
End If
Next i
End With
End Sub
wrightyrx7
03-16-2012, 01:04 PM
Thanks xld,
How would you advise i learn VBA? Been trying for a few weeks but only bits seem to be sinking in.
Reading doesnt seem to want to stay in my head haha
dazwm
03-16-2012, 01:15 PM
Hi xld, I know there is some type of step through you can do on a code but does that actually tell you what each part does? Could you explain a little about the code you just did to help our learning please.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.