Thanks John, you understand perfectly. I had a , before the Range rather than a . which is why it would not work!
Any chance I can ask 2 questions?
1. In your original code, the paste into the other workbook is perfectly located at cell A107. How does your code know where to paste it?
2. If I wanted to wrap some code around it so that the macro loops round until the Value in the Filter Cell in the other Worksheet ="XXX" at which point it should finish. Is that something you could help me with? Current code shown below
Again, many thanks
Sub bigfishprf()
' Section 1 - Copy Stores'
'
Sheets("Stores").Select
Range("A2:A500").Select
Selection.Copy
Range("b2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Staff").Select
'
' Section 2 - Open Timesheet Master Template
' I WOULD WANT TO CHECK HERE IF Sheets("Stores").Range("B2").Value = "XXX". If it does
' then repeat the rest of the code in the Macro 1 more time. If it does ="XXX" then
' the processing is complete
'
Workbooks.Open Filename:= _
"F:\PRF Docs\Grainstore Ltd\Antler\FINAL TEMPLATES\Retail Timesheet MasterTemplate.xlsx"
Windows("Retail Staff List.xlsm").Activate
'
' Section - 3 - Create Timesheet for next store in list
'
Dim lr As Long
lr = Cells(Rows.Count, 1).End(xlUp).Row
With Range("A2:A" & lr)
.Autofilter 7, Sheets("Stores").Range("B2").Value
.SpecialCells(xlCellTypeVisible).EntireRow.Copy Workbooks("Retail Timesheet MasterTemplate.xlsx").Sheets("Parameters").Range("A" & Rows.Count).End(3)(2)
End With
ActiveSheet.AutoFilterMode = False
Rows("1:1").Select
Selection.Autofilter
' Section 4 - Prepare Store List for next store
'
Sheets("Stores").Select
Range("B3:B500").Select
Selection.Copy
Range("B2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End Sub
Bookmarks