T
tim_stone
I have a very large worksheet with a number of people on it. There are
multiple rows of data for each of these people.
I have managed to write code to set up a member tab for each of these
people (over 1000 !) but what I now want to do is copy the data for
each person to the relevant worksheet.
This is my code:
Sub ExportData()
Dim wb As Workbook
Dim ws As Worksheet
Dim strSheetName As String
Set wb = Workbooks("PWSallocationsv1 3 (2).xls")
For Each ws In wb.Worksheets
If Not ws.Name = "Sheet1" Then
If Not ws.Name = "Raw Data" Then
'MsgBox ws.Name
strSheetName = ws.Name
Sheets("Raw Data").Select
Selection.AutoFilter Field:=3, Criteria1:=strSheetName
Selection.SpecialCells(xlCellTypeVisible).Select
Selection.Copy
Sheets(strSheetName).Select
Range("A1").Select
ActiveSheet.Paste
End If
End If
Next ws
End Sub
However, I have two issues here. Sometimes when I run it I get a
message saying that 'Excel can not complete this task with available
resources. Choose less data or close other applications'. This is not
a memory issue as this is being run on a Citrix server.
The other is that the code copies the first person's data but then
loops thorugh the rest without putting the data in the sheet. The
sheets are being selected and if I step through the code, the data is
being copied to the clipboard but it not pasted.
Can anybody help with either of these two issues.
multiple rows of data for each of these people.
I have managed to write code to set up a member tab for each of these
people (over 1000 !) but what I now want to do is copy the data for
each person to the relevant worksheet.
This is my code:
Sub ExportData()
Dim wb As Workbook
Dim ws As Worksheet
Dim strSheetName As String
Set wb = Workbooks("PWSallocationsv1 3 (2).xls")
For Each ws In wb.Worksheets
If Not ws.Name = "Sheet1" Then
If Not ws.Name = "Raw Data" Then
'MsgBox ws.Name
strSheetName = ws.Name
Sheets("Raw Data").Select
Selection.AutoFilter Field:=3, Criteria1:=strSheetName
Selection.SpecialCells(xlCellTypeVisible).Select
Selection.Copy
Sheets(strSheetName).Select
Range("A1").Select
ActiveSheet.Paste
End If
End If
Next ws
End Sub
However, I have two issues here. Sometimes when I run it I get a
message saying that 'Excel can not complete this task with available
resources. Choose less data or close other applications'. This is not
a memory issue as this is being run on a Citrix server.
The other is that the code copies the first person's data but then
loops thorugh the rest without putting the data in the sheet. The
sheets are being selected and if I step through the code, the data is
being copied to the clipboard but it not pasted.
Can anybody help with either of these two issues.