Forum Discussion
tridi94
Aug 18, 2022Copper Contributor
consolidate data from multiple excelsheets and append the same to main sheet.
I have the below requirement. I need to copy the data from second row for each of the worksheets and consolidate them to main excel sheet by appending one by one . Note. If main worksheet is no...
Matt Mickle
Aug 18, 2022Bronze Contributor
Please use this code:
Sub Test()
Dim lrow As Long
Dim sht As Worksheet
'define last row
lrow = Sheets("Import").Cells(Rows.Count, 1).End(xlUp).Row
For Each sht In ThisWorkbook.Sheets
If sht.Name <> "Import" Then
'Move the data from cells (Copy and Paste)....
sht.Range("A2:D2").Copy Sheets("Import").Range("A" & lrow + 1)
lrow = lrow + 1 'increment last row by one....
End If
Next
End Subtridi94
Aug 29, 2022Copper Contributor
Matt Mickle thanks .
but now its only copying the row2 from all the excel sheets
I need to copy all the rows from all the excel sheet excluding the row1.And each excel sheet the row the row count will vary.
could you please advise.