Hello, I'm very to new macros and am trying to find tweak the one below. It's not quite working properly.
I want to merge the data from the first three worksheets of the attached file to the last worksheet called "Merged Data". Appreciate the help.
Thanks!
Sub D_Merge()
Dim w1 As Worksheet, w2 As Worksheet, w3 As Worksheet, w4 As Worksheet
Set w1 = Sheets("Concur Activity Rearranged")
Set w2 = Sheets("Concur Accrual Rearranged")
Set w3 = Sheets("CC Accrual US Rearranged")
Set w4 = Sheets("Merged Data")
Dim lr1 As Long, lr2 As Long, lr3 As Long, lr4 As Long
lr1 = w1.Range("A" & Rows.Count).End(xlUp).Row
lr2 = w2.Range("A" & Rows.Count).End(xlUp).Row
lr3 = w3.Range("A" & Rows.Count).End(xlUp).Row
lr4 = w4.Range("A" & Rows.Count).End(xlUp).Row
Application.ScreenUpdating = False
'Copies data from w1 and pastes to destsheet
w1.Range("A5:AV" & lr1).Copy w4.Range("A" & lr4 + 1)
lr4 = w4.Range("A" & Rows.Count).End(xlUp).Row
w2.Range("A5:AV" & lr1).Copy w4.Range("A" & lr4 + 1)
lr4 = w4.Range("A" & Rows.Count).End(xlUp).Row
w3.Range("A5:AV" & lr1).Copy w4.Range("A" & lr4 + 1)
lr4 = w4.Range("A" & Rows.Count).End(xlUp).Row
Application.CutCopyMode = False
Application.ScreenUpdating = True
MsgBox "Merge Complete!"
End Sub
Bookmarks