|
-
Jul 16th, 2009, 05:32 PM
#1
Thread Starter
Lively Member
[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
Last edited by datapard; Jul 16th, 2009 at 05:36 PM.
If you have to do it more than once...
Automate it!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|