Hello,
I am working with Excel 2003, and I have been searching for how to fix an issue that has been coming up with an Excel sheet developed by someone else. The specific error I get when I run my selections is: runtime error 1004 excel cannot create or use the data range reference because it is too complex.
This is where the debug leads me within the code:
I have been researching this issue and it seems like my query is exceeding the limit from within this section. I am not very versed with VBA (although I am now the owner of several books!). I'm not sure where specifically this error needs to be fixed? Any suggestions or help would be greatly appreciated.
I am working with Excel 2003, and I have been searching for how to fix an issue that has been coming up with an Excel sheet developed by someone else. The specific error I get when I run my selections is: runtime error 1004 excel cannot create or use the data range reference because it is too complex.
This is where the debug leads me within the code:
Code:
Function DR(Criteria As String, pos As Integer, IndexString As String)
Sheets(IndexString).Select
Selection.AutoFilter
Selection.AutoFilter Field:=pos, Criteria1:=Criteria
[COLOR="Red"]ActiveSheet.UsedRange.SpecialCells(xlCellTypeVisible).Areas(1).Columns(1).Cells(2, 1).Select[/COLOR]
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.EntireRow.Delete
Range("A1").Select
Selection.AutoFilter
End Function
I have been researching this issue and it seems like my query is exceeding the limit from within this section. I am not very versed with VBA (although I am now the owner of several books!). I'm not sure where specifically this error needs to be fixed? Any suggestions or help would be greatly appreciated.