G
Guest
How do you delete a row when it contains a text string within other text
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
"logo"
nested within other text in a cell. I need a macro to delete those rows.
The
following will delete rows if the ENTIRE text in the cell matches the text
in
quotes in this statement:
If Cells(iRow, 1) = "Hours of Operation" Then Rows(iRow).Delete
How can I make this work for my problem?
code
would be:
If InStr(1, Cells(iRow, 1), " logo ", vbTextCompare) > 0 Then
Rows(iRow).Delete
End If
Is this correct, putting a space before and after the word?
Maybe. What if logo is at the end of a sentence, then it is followed by a
period, not a space. Same goes for colons, semi-colon, question marks,
exclamation marks, opening and closing parentheses, brackets (square and
angled), etc., etc. It is not an easy problem to resolve. The key to
making it work is to be looking for very unique words or multiple words
with spaces between them... these kind of things tend to be unique enough
to guarantee no false positives. Although the multiple word ones can run
into a problem if they are split at the end of a forced line feed.
in the macro statement and it worked!
Ron de Bruin said:I not think there is more information then that is in the VBA help for "Range.Find Method"
"Range.Find Method"
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.