![]() |
text within a string
G'day guys, I know there is a simple answer to this. I am searching a column of values and want to stop when I hit a certain string of text. Problem is it will be in larger string. example: in the below example I find the load case (say load1) but load1 is in a larger string. this is load1 401 405 410 417 418 this is load2 404 407 413 415 418 419 thanks for your help. -- nelg ------------------------------------------------------------------------ nelg's Profile: http://www.excelforum.com/member.php...o&userid=27771 View this thread: http://www.excelforum.com/showthread...hreadid=495415 |
text within a string
n,
Check out the InStr function in VBA help. Jim Cone San Francisco, USA http://www.realezsites.com/bus/primitivesoftware "nelg" wrote in message ... G'day guys, I know there is a simple answer to this. I am searching a column of values and want to stop when I hit a certain string of text. Problem is it will be in larger string. example: in the below example I find the load case (say load1) but load1 is in a larger string. this is load1 401 405 410 417 418 this is load2 404 407 413 415 418 419 thanks for your help. nelg |
text within a string
tom just posted this earlier today to help someone out.
see if it helps you Option Explicit Dim rng As Range, rng1 As Range Dim myVar As String Sub test() myVar = "this is load1" Set rng = Range("a1:a13") Set rng1 = rng.Find(myVar) If Not rng1 Is Nothing Then MsgBox myVar & " found at " & rng1.Address Else MsgBox myVar & " was not found in " & rng.Address End If End Sub -- Gary "nelg" wrote in message ... G'day guys, I know there is a simple answer to this. I am searching a column of values and want to stop when I hit a certain string of text. Problem is it will be in larger string. example: in the below example I find the load case (say load1) but load1 is in a larger string. this is load1 401 405 410 417 418 this is load2 404 407 413 415 418 419 thanks for your help. -- nelg ------------------------------------------------------------------------ nelg's Profile: http://www.excelforum.com/member.php...o&userid=27771 View this thread: http://www.excelforum.com/showthread...hreadid=495415 |
All times are GMT +1. The time now is 05:12 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com