Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Find text in string

Hi. Within a loop, I would like for the macro to find the text "On Hand"
within a cell on a given row. If the text exists anywhere in the cell, I
would like to delete the row.

What command should I use? I know that if I wanted to find this in the left
or right of the string I would use the LEFT or RIGHT function, but I don't
know how to have it search anywhere in the string. Thanks!
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Find text in string

Sub Macro1()
If InStr(ActiveCell, "on hand") Then ActiveCell.EntireRow.Delete
End Sub

Regards,
KL

"Mike D." <Mike wrote in message
...
Hi. Within a loop, I would like for the macro to find the text "On Hand"
within a cell on a given row. If the text exists anywhere in the cell, I
would like to delete the row.

What command should I use? I know that if I wanted to find this in the
left
or right of the string I would use the LEFT or RIGHT function, but I don't
know how to have it search anywhere in the string. Thanks!



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default Find text in string

Hi

Instr, like

S = "neon hand sign"
If InStr(S, "on hand") 0 Then MsgBox "Found it"

HTH. best wishes Harald

"Mike D." <Mike skrev i melding
...
Hi. Within a loop, I would like for the macro to find the text "On Hand"
within a cell on a given row. If the text exists anywhere in the cell, I
would like to delete the row.

What command should I use? I know that if I wanted to find this in the

left
or right of the string I would use the LEFT or RIGHT function, but I don't
know how to have it search anywhere in the string. Thanks!



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default Find text in string

Thanks, Folks! The INSTR works well.

Mike.

"Mike D." wrote:

Hi. Within a loop, I would like for the macro to find the text "On Hand"
within a cell on a given row. If the text exists anywhere in the cell, I
would like to delete the row.

What command should I use? I know that if I wanted to find this in the left
or right of the string I would use the LEFT or RIGHT function, but I don't
know how to have it search anywhere in the string. Thanks!



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Find Specific Text in a Text String Confused_in_Houston[_2_] Excel Discussion (Misc queries) 2 January 26th 09 08:17 PM
Search, find or lookup defined text in text string zzxxcc Excel Worksheet Functions 9 September 6th 07 09:37 PM
can you find specific text in a string ignoring any other text chriscp Excel Discussion (Misc queries) 1 September 18th 05 09:54 PM
backwards find function to find character in a string of text Ashleigh K. Excel Programming 1 January 14th 04 04:36 PM
How to Find text in String? Milind Excel Programming 0 September 2nd 03 10:26 PM


All times are GMT +1. The time now is 10:00 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"