I have a spreadsheet which has multiple sheets (one per staff member), all identical, and have been using the code below to copy the data from the individual sheets onto a Master sheet entitled "Team Data".
In theory the code was working fine, however as this workbook has to be a shared workbook between the staff some problems have cropped up.
The sheets use columns A to J (With Row A containing identical headings) and the number of rows requiring to be copied vary.
Since I've been using this a s a shared book I have found that when a staff member makes changes and saves, it overwrites previous saves by other staff (this seems to be overwriting not only on the main spreadsheet but also between tabs.... so if user 1 fills in tab 1, user 2 fills in tab 2....when saving tab 1 is overwritten with tab 2 data.
Any idea's how to fix this??
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
Bookmarks