Searching for specific text
I need to loop down a range and stop when a cell contains the text "xyz
somewhere within a cell. Thank -- Message posted from http://www.ExcelForum.com |
Searching for specific text
Hi
one way: try something like sub foo() dim rng as range dim cell as range set rng = activesheet.range("A1:A100") for each cell in rng if instr (cell.value,"xyz") then msgbox cell.address cell.select exit sub end if next end sub -- Regards Frank Kabel Frankfurt, Germany I need to loop down a range and stop when a cell contains the text "xyz" somewhere within a cell. Thanks --- Message posted from http://www.ExcelForum.com/ |
Searching for specific text
try this
Sub findxyz() x = Range("d7:d12").Find("xyz", lookat:=xlPart).Address MsgBox x End Sub sub gotoxyz Range(Range("d7:d12").Find("xyz", lookat:=xlPart).Address).Select end sub -- Don Guillett SalesAid Software "simoncohen " wrote in message ... I need to loop down a range and stop when a cell contains the text "xyz" somewhere within a cell. Thanks --- Message posted from http://www.ExcelForum.com/ |
All times are GMT +1. The time now is 12:25 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com