Hi to all,
Could somebody please help me I need to join rows from different sheets with common fields, See attachment example.
Hi to all,
Could somebody please help me I need to join rows from different sheets with common fields, See attachment example.
Life is not as complicated as we think it is, we make it complicated.
IF you can change it, then strive for excellence.
IF not, then let it happen, don't worry about it and live a happier life.
Let's Have Fun!
Julio
[VBA]
Option Explicit
Sub Macro1()
Dim WS As Worksheet, wsht As Worksheet
Dim i As Long, j As Long
Dim c As Range
Set WS = Sheets.Add
Sheets("Data1").Range("A").Copy WS.Range("A1")
For i = 2 To 3
Set wsht = Sheets("Data" & i)
wsht.Range("A11").Copy WS.Range("A1").Offset(, (i - 1) * 4)
For j = 2 To WS.Cells(Rows.Count, 1).End(xlUp).Row
Set c = wsht.Columns(1).Find(WS.Cells(j, 1))
If Not c Is Nothing Then
c.Resize(, 4).Copy WS.Cells(j, 1).Offset(, (i - 1) * 4)
End If
Next
Next
End Sub
[/VBA]
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
Thank you, it works great, of course you already knew that.
Life is not as complicated as we think it is, we make it complicated.
IF you can change it, then strive for excellence.
IF not, then let it happen, don't worry about it and live a happier life.
Let's Have Fun!
Julio