I am using below code to extract & consolidate data from multiple sheets into 1 new sheet of same excel file.
But this Macro copying all rows from all sheets. I want to extract only active data (want to stop extracting when there is no data (space/empty) in Column 'A', and move into next sheet (or tab) for extraction.
Also i want to skip copying header row(1st row) from each sheet (tab).
Could you please share me code for the same.
But this Macro copying all rows from all sheets. I want to extract only active data (want to stop extracting when there is no data (space/empty) in Column 'A', and move into next sheet (or tab) for extraction.
Also i want to skip copying header row(1st row) from each sheet (tab).
Could you please share me code for the same.
Code:
Sub Combine()
Dim I As Long
Dim xRg As Range
On Error Resume Next
Worksheets.Add Sheets(1)
ActiveSheet.Name = "Combined"
For I = 2 To Sheets.Count
Set xRg = Sheets(1).UsedRange
If I > 2 Then
Set xRg = Sheets(1).Cells(xRg.Rows.Count + 1, 1)
End If
Sheets(I).Activate
ActiveSheet.UsedRange.Copy xRg
Next
End Sub