|
-
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!
-
Jul 17th, 2009, 02:09 AM
#2
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
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
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
|