snoopies
07-05-2005, 07:36 AM
Hi, I use the following VBA codes in 2 Excel files (There are in same structure, just different data), one works smoothly, but the other one has error message (saying the autofilter in class range is wrong?). I'm quite confuesd as I didn't change anything...
With oWs
For I= .Cells(.Rows.Count, "A").End(xlUp).Row To 2 Step -1
If .Range("C" & I).Value <> "" Then
If .Range("H" & lRw).Value = "" Then .Range("I" & lRw).Value = "N"
End If
Next lRw
.Range("A1:I" & .Cells(.Rows.Count, "A").End(xlUp).Row).AutoFilter Field:=9, Criteria1:="<>N"
End With
With oWs
For I= .Cells(.Rows.Count, "A").End(xlUp).Row To 2 Step -1
If .Range("C" & I).Value <> "" Then
If .Range("H" & lRw).Value = "" Then .Range("I" & lRw).Value = "N"
End If
Next lRw
.Range("A1:I" & .Cells(.Rows.Count, "A").End(xlUp).Row).AutoFilter Field:=9, Criteria1:="<>N"
End With