Forum

How to copy data fr...
 
Notifications
Clear all

How to copy data from multiple sheet into one summary with add on new column?

3 Posts
2 Users
0 Reactions
71 Views
(@Anonymous)
Posts: 0
New Member Guest
 

Hi,

Anyone can help me to understand how to add a new column in summary tab after or before copying data from multiple sheet into one?

Example: to add a new column "description" after column B at summary page.

Thank you.

Sub CombineSheet1()
Dim i As Integer
Dim Lr As Long
Dim wksDst As Worksheet

Set wksDst = Worksheets("Summary")
For i = 2 To Sheets.Count
Lr = wksDst.Cells(Rows.Count, 1).End(xlUp).Row + 1
Sheets(i).Cells(1, 1).CurrentRegion.Offset(1).Copy wksDst.Cells(Lr, "A")
Next i
End Sub

 
Posted : 13/12/2019 9:45 pm
(@sunnykow)
Posts: 1417
Noble Member
 

Hi Chiew Yen

Try this

Sub CombineSheet1()
Dim i As Integer
Dim Lr As Long
Dim wksDst As Worksheet

Set wksDst = Worksheets("Summary")
For i = 2 To Sheets.Count
Lr = wksDst.Cells(Rows.Count, 1).End(xlUp).Row + 1
Sheets(i).Cells(1, 1).CurrentRegion.Offset(1).Copy wksDst.Cells(Lr, "A")
Next i

'Insert Column
Columns("C:C").Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Range("C1") = "Description"

End Sub

You can easily record a macro to insert the column.

Hope this helps.

Sunny

 
Posted : 14/12/2019 7:55 pm
(@Anonymous)
Posts: 0
New Member Guest
 

Thank you very much Sunny. It is really solved my problem. Now I am going to add on the highlight yellow color on the additional column add and add in the formula. Thank you!

 
Posted : 16/12/2019 4:44 am
Share: