vaibhavdxt
New Member
- Joined
- Nov 27, 2016
- Messages
- 6
I am using same code in three different functions and it's working fine with two of them but with third one it's giving me "Error 1004: AutoFilter method of Range class failed".
I have a long code and I am getting error in this part of the code: -
Code:-
Public Sub XYZ (fcstartdate As Long, finaldate As Long)
With Sheets("XYZ")
.Range("$A$1:$AB$860423").AutoFilter Field:=14, Operator:= _
xlFilterValues, Criteria1:=">=" & fcstartdate, Operator:=xlAnd, Criteria2:="<=" & finaldate
Selection.SpecialCells(xlCellTypeVisible).Select
End With
End Sub
Please tell me what I should do to correct it.
I have checked that sheet is NOT protected and there is no merged rows. I also checked the number of rows in the sheet by recording macro which tells me there are 860423 though I see 67423 rows only.
Also when I ran the code with both figures (860423 and 67423), it gave me the same error.
Thanks in advance.
Regards
I have a long code and I am getting error in this part of the code: -
Code:-
Public Sub XYZ (fcstartdate As Long, finaldate As Long)
With Sheets("XYZ")
.Range("$A$1:$AB$860423").AutoFilter Field:=14, Operator:= _
xlFilterValues, Criteria1:=">=" & fcstartdate, Operator:=xlAnd, Criteria2:="<=" & finaldate
Selection.SpecialCells(xlCellTypeVisible).Select
End With
End Sub
Please tell me what I should do to correct it.
I have checked that sheet is NOT protected and there is no merged rows. I also checked the number of rows in the sheet by recording macro which tells me there are 860423 though I see 67423 rows only.
Also when I ran the code with both figures (860423 and 67423), it gave me the same error.
Thanks in advance.
Regards