thread707-1547015
Have a similar challenge whereby I am interested in using Autofilter to copy data to Excel Templates.
Reviewed the above thread and curious as to what modifications should be made to the code below if I want to filter the data to separate Excel Templates?
In other words, I have built 5 unique Excel Templates at C:\...\Microsoft Data... (with macros to generate pivot tables on the dynamic range in Sheet1) -one for each unique filtered value in my list (Widgets, Bolts,Blocks,Washers,Pipes).
Also, I currently receive a run-time error when running the code below that indicate that Excel cannot access the file 'C:\72BF8000'
Sub Testing()
'
' Testing Macro
'
Dim r As Range, ws As Worksheet, i As Integer
Set ws = ActiveSheet
i = 1
For Each r In
Have a similar challenge whereby I am interested in using Autofilter to copy data to Excel Templates.
Reviewed the above thread and curious as to what modifications should be made to the code below if I want to filter the data to separate Excel Templates?
In other words, I have built 5 unique Excel Templates at C:\...\Microsoft Data... (with macros to generate pivot tables on the dynamic range in Sheet1) -one for each unique filtered value in my list (Widgets, Bolts,Blocks,Washers,Pipes).
Also, I currently receive a run-time error when running the code below that indicate that Excel cannot access the file 'C:\72BF8000'
Sub Testing()
'
' Testing Macro
'
Dim r As Range, ws As Worksheet, i As Integer
Set ws = ActiveSheet
i = 1
For Each r In
ws.[D1].AutoFilter _
Field:=4, _
Criteria1:=r.Value
'r.CurrentRegion.Copy
ws.[D1].CurrentRegion.Copy
With Workbooks.Add
With .Sheets(1)
.Paste
.UsedRange.EntireColumn.AutoFit
.SaveAs "C:\FirstTest" & i & ".xls"
End With
.Close
End With
i = i + 1
Next
End Sub