[Excel] 2003 vs 2007 - Range functions
This works in 2000/2003, unfortunately I'm getting
Run-time error '438':
Object doesn't support this property or method.
The code is below.
Code:
Sub cleanData()
'
Dim rng As Range
Dim lLastrow As Long
Selection.AutoFilter
ActiveSheet.UsedRange
lLastrow = ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell).Row
Set rng = Range("J2", Cells(lLastrow, "J"))
ActiveSheet.rng.AutoFilter Field:=10, Criteria1:=Array( _
"Key Target", "Dead", "Lead", "Won", "="), Operator:=xlFilterValues
rng.SpecialCells(xlCellTypeVisible).EntireRow.Delete
Range("A1").Select
Selection.AutoFilter
End Sub
The following is were the code appears to break.
ActiveSheet.rng.AutoFilter Field:=10, Criteria1:=Array("Key Target", "Dead", "Lead", "Won", "="), Operator:=xlFilterValues
Since the file will never have a set number of rows, I really need to be able to set the range on the fly. This office has both 2003 and 2007 and appears to be converting slowing to being all 2007, which means that the macro packet I build for them has got to run cleanly in both. Any suggestions.
datapard
Re: [Excel] 2003 vs 2007 - Range functions
I don't have 2007 at the moment but my suggestion to you is to record a macro in 2007 and then check the syntax out ;)