Hello,
I am looking to use the Find function to find multiple criteria.
Here is my code:
Dim mFind As Variant
Dim i As Integer
mFind = Array("LetterA", "LetterC", "LetterE", "LetterH", "LetterL", "LetterO", "LetterP", "LetterR")
For i = LBound(mFind) to UBound(mFind)
Rows(1).Find(What:=mFind(i), LookIn:xlValues, Lookat:=xlWhole, MatchCase:=False).EntireColumn.Delete
Next
After executing this macro, Columns "LetterA", "LetterC", "LetterE" got deleted successfully,
then it stops and pops out an Error Runtime 91 for Object-Variable or With Block Variable Not Set
Can someone please help to explain why i got this error message and how can i overcome this coding error?
I am open for an alternative coding suggestion to resolve this issue. Your help is greatly appreciated.
Thanks.
I am looking to use the Find function to find multiple criteria.
Here is my code:
Dim mFind As Variant
Dim i As Integer
mFind = Array("LetterA", "LetterC", "LetterE", "LetterH", "LetterL", "LetterO", "LetterP", "LetterR")
For i = LBound(mFind) to UBound(mFind)
Rows(1).Find(What:=mFind(i), LookIn:xlValues, Lookat:=xlWhole, MatchCase:=False).EntireColumn.Delete
Next
After executing this macro, Columns "LetterA", "LetterC", "LetterE" got deleted successfully,
then it stops and pops out an Error Runtime 91 for Object-Variable or With Block Variable Not Set
Can someone please help to explain why i got this error message and how can i overcome this coding error?
I am open for an alternative coding suggestion to resolve this issue. Your help is greatly appreciated.
Thanks.