The_Rock
Board Regular
- Joined
- Jul 2, 2007
- Messages
- 174
Hi Folks
I have a field (Column K 'Letter') that contains Letters 1,3,4,6,7,8 (2 & 5 are missing).
What I am trying to do is limit to Letter 1, copy the results to a blank spreadsheet, save and then repeat for the next letter.
How can I modify the below so that it will loop through all the variables in the Autofilter?
This is the code in it's entirety:
I have a field (Column K 'Letter') that contains Letters 1,3,4,6,7,8 (2 & 5 are missing).
What I am trying to do is limit to Letter 1, copy the results to a blank spreadsheet, save and then repeat for the next letter.
How can I modify the below so that it will loop through all the variables in the Autofilter?
Code:
Selection.AutoFilter Field:=11, Criteria1:="Letter 1"
This is the code in it's entirety:
Code:
Sub Create_Letters()
Do
Sheets("FINAL").Select
Range("G1:AM" & Range("G" & Rows.Count).End(xlUp).Row).Select
Selection.AutoFilter Field:=11, Criteria1:="Letter 1"
Selection.Copy
Workbooks.Add
ActiveWindow.Zoom = 80
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteColumnWidths, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
ActiveSheet.Paste
Range("A2").Select
ActiveWindow.FreezePanes = True
'Save Template as per BP Name
ThisFile = Range("E2").Value
ActiveWorkbook.SaveAs "C:\Documents and Settings\My Documents\Work\Final Letters\" & Range("E2").Value & ".xls"
ActiveWorkbook.Close savechanges:=False 'true
Loop Until IsEmpty(ActiveCell.Offset(1, 0))
End Sub