![]() |
stopping at text....
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 text. Is there any way to write a simple if statement that says "If next cell does not equal an integer, exit sub"? example: in the below example I find the load case (say load1) then search under it for node 404. As 404 is not there I need it to stop at load2 and not continue to the 404 value. load1 401 405 410 417 418 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=495408 |
stopping at text....
n,
'--------------------- Sub StopAtText() Dim rngList As Excel.Range Dim rngCell As Excel.Range Set rngList = Range("B5:B10") For Each rngCell In rngList If Not IsNumeric(rngCell) Then Exit For ' or ' If Val(rngCell) = 0 Then Exit For ' or ' If Not Left(rngCell, 1) Like "#" Then Exit For Next End Sub '----------------------- 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 text. Is there any way to write a simple if statement that says "If next cell does not equal an integer, exit sub"? example: in the below example I find the load case (say load1) then search under it for node 404. As 404 is not there I need it to stop at load2 and not continue to the 404 value. load1 401 405 410 417 418 load2 404 407 413 415 418 419 thanks for your help. nelg |
stopping at text....
Thanks Jim that worked great now onto the second problem. See the sam thread for the change -- nel ----------------------------------------------------------------------- nelg's Profile: http://www.excelforum.com/member.php...fo&userid=2777 View this thread: http://www.excelforum.com/showthread.php?threadid=49540 |
All times are GMT +1. The time now is 06:10 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com