rdarrylhudson
New Member
- Joined
- Mar 19, 2024
- Messages
- 2
- Office Version
- 2019
- Platform
- Windows
As the title states, I am running an advanced filter macro that works for a while, but stops working with a error 1004 "advancedfilter method of range class failed". This appears to start happening after I run a different advanced filter macro in the same workbook. Here are all the macros I have in the workbook.
The Pivot_Update sheet it filters from:
What the pages to copy into look like
I can run the "Adv_Filter" on a certain page or I can run the Run_All to go through several pages that need the data. Why does it work for a while, then start giving me the error.
Thank for any help
The Pivot_Update sheet it filters from:
What the pages to copy into look like
I can run the "Adv_Filter" on a certain page or I can run the Run_All to go through several pages that need the data. Why does it work for a while, then start giving me the error.
VBA Code:
Sub Adv_Filter()
Sheets("Pivot_Update").Range("Q4:U1048576").AdvancedFilter Action:= _
xlFilterCopy, CriteriaRange:=Range("D1:D2"), CopyToRange:=Range( _
"B5:F1048576"), Unique:=False
Cells.EntireColumn.AutoFit
Call Adv_Filter_current
End Sub
Sub Run_All()
Sheets("Allen Grant").Select
Call Adv_Filter
Call Next_Sheet
End Sub
Sub Next_Sheet()
On Error Resume Next
Sheets(ActiveSheet.Index + 1).Activate
If Err.Number <> 0 Then Exit Sub
Call Adv_Filter
Call Next_Sheet
End Sub
Sub Adv_Filter_current()
Sheets("Pivot_Update").Range("Y4:AC104865").AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=Range("d1:d2"), CopyToRange:=Range( _
"N5:R104865"), Unique:=False
Cells.EntireColumn.AutoFit
Call Adv_Filter_Combine
End Sub
Sub Adv_Filter_Combine()
'
' Adv_Filter_Combine
'
' Call Delete_old_Current
Range("N5:s978").AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=Range( _
"S1:S2"), CopyToRange:=Range("B1000:g1048576"), Unique:=False
Call Delete_Current_Amounts_After_Copy
Call Sort_Combined
End Sub
Sub Delete_Current_Amounts_After_Copy()
'
' Move_Current Macro
'
'
Range("C1000:C1048576").Select
Selection.ClearContents
Range("g1000:g1048576").Select
Selection.ClearContents
Range("a1000:f1000").Select
Selection.ClearContents
End Sub
Sub Delete_old_Current()
'
' Delete_old_Current Macro
'
'
Range("A1000:F1048576").Select
Selection.ClearContents
End Sub
Sub Sort_Combined()
'
' Sort_Combined Macro
'
Range("B6:F3050").Sort Key1:=Range("B6"), Order1:=xlAscending, Header:=xlNo
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Sheets
ws.Activate
ws.[a1].Select
ActiveWindow.Zoom = 100
Next ws
ActiveWorkbook.Worksheets(1).Activate
End Sub
Thank for any help