Hi, hope somecan help. I am trying to autopopulate a master sheet in a workbook from multiple sheets in the same workbook.
I have found this code online... can somehelp help explain what the code means as I am unsure how to edit it to make it relevant to my workbook. Please note, There are a certain number of sheets that I want to populate from. (not all sheets will feed the mastersheet)
Hope this makes sense. Thank you in advance for your help
R
Private Sub Worksheet_Activate()
Dim Sheet As Worksheet
For Each Sheet In Me.Parent.Sheets
If Sheet.Name <> Me.Name Then
If Sheet.Cells(Rows.Count, 1).End(xlUp).Row <> 1 Then
Sheet.Range(Sheet.Cells(2, 1), Sheet.Cells(Sheet.Cells(Rows.Count, 1).End(xlUp).Row, 10)).Copy Destination:=Me.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)
End If
Else
Me.Range(Cells(2, 1), Cells(Rows.Count, 10)).Clear
End If
Next Sheet
End Sub
I have found this code online... can somehelp help explain what the code means as I am unsure how to edit it to make it relevant to my workbook. Please note, There are a certain number of sheets that I want to populate from. (not all sheets will feed the mastersheet)
Hope this makes sense. Thank you in advance for your help
R
Private Sub Worksheet_Activate()
Dim Sheet As Worksheet
For Each Sheet In Me.Parent.Sheets
If Sheet.Name <> Me.Name Then
If Sheet.Cells(Rows.Count, 1).End(xlUp).Row <> 1 Then
Sheet.Range(Sheet.Cells(2, 1), Sheet.Cells(Sheet.Cells(Rows.Count, 1).End(xlUp).Row, 10)).Copy Destination:=Me.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)
End If
Else
Me.Range(Cells(2, 1), Cells(Rows.Count, 10)).Clear
End If
Next Sheet
End Sub