hip2b2
Board Regular
- Joined
- May 5, 2003
- Messages
- 135
- Office Version
- 2019
- Platform
- Windows
I'm trying to understand my own macro (created with generous help from MrExcel posters) turning on and off lines of code that confuse me. I am left with the following questions, if anyone can help me understand I'll never have to wonder about these again.
Thanks in advance
hip
VBA Code:
Set h = Sheets("Sheet 1")
Application.GoTo ActiveSheet.Range("A1"), True
If h.AutoFilterMode Then h.AutoFilterMode = False '<<< Why is this not AutoFilterMode = TRUE ?????
lr = Columns("A:L").Find(What:="*", LookIn:=xlValues, SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
With h.Range("A6:L" & lr)
.AutoFilter Field:=2, Criteria1:="=ABC" & strName & "*", Operator:=xlAnd
.Offset(1).Resize(.Rows.Count - 1).EntireRow.Delete
.AutoFilter Field:=2 '<<< Why do I need these lines ???????
.AutoFilter Field:=12, Criteria1:="=123" & strName & "*", Operator:=xlAnd
.Offset(1).Resize(.Rows.Count - 1).EntireRow.Delete
.AutoFilter Field:=12 '<<< Why do I need these lines ???????
.AutoFilter Field:=12, Criteria1:="=XYZ" & strName & "*", Operator:=xlAnd
.Offset(1).Resize(.Rows.Count - 1).EntireRow.Delete
.AutoFilter Field:=12 '<<< Why do I need these lines ???????
h.AutoFilterMode = False
Thanks in advance
hip