If .value < "some text" Then not working. Pls hlp
I tried to replicate your problem. I copied and pasted your code into a
sample worksheet.
Unfortunately, the code ran perfectly.
--
Gary's Student
"Bythsx-Addagio" wrote:
Dim LastRow As Long, r As Long
LastRow = ActiveSheet.UsedRange.Rows.Count
For r = LastRow To 1 Step -1
If UCase(Cells(r, 1).Value) < "ABCD - SUPPLY" Then Rows(r).Delete
Next r
The above code works when the comparison text is not hyphenated. (no dash or
spaces). It seems that once I add the Hyphenation it doesn't work. I tested
with a MSGBOX to see what the UCase(Cells(r, 1).Value) was and it looked
identical but the code deleted the row anyway.
What I would really like to do is use a wild card here so the compariosn
text is just "ABCD" and a wildcard (Not sure which to use here % or *. This
way I can delete every row that does not have the prefix "ABCD" "ABCD%" or
"ABCD*"
Is this possible? Can someone please advise?
thanks,
G
|