![]() |
If find is true then.....
Hey everyone, quick question. Im looking to have some code that wil first try to find a value on a page. If it can't find that value, the it does a set of actions, otherwise, it does a different set of actions At first I thought to use an If, then, else statement, but I don' really know how to incorporate the Find condition. If I could get som help that'd be great. thanks!! -- jpizzl ----------------------------------------------------------------------- jpizzle's Profile: http://www.excelforum.com/member.php...fo&userid=2392 View this thread: http://www.excelforum.com/showthread.php?threadid=38277 |
If find is true then.....
Dim rng as Range
Dim sTarget as String sTarget = "ABCDE" set rng =Cells.Find(What:=sTarget, _ After:=ActiveCell, _ LookIn:=xlFormulas, _ LookAt:=xlPart, _ SearchOrder:=xlByRows, _ SearchDirection:=xlNext, _ MatchCase:=False) if not rng is nothing then msgbox "found in cell " & rng.Address Else msgbox "Not found" End Sub -- Regards, Tom Ogilvy "jpizzle" wrote in message ... Hey everyone, quick question. Im looking to have some code that will first try to find a value on a page. If it can't find that value, then it does a set of actions, otherwise, it does a different set of actions. At first I thought to use an If, then, else statement, but I don't really know how to incorporate the Find condition. If I could get some help that'd be great. thanks!!! -- jpizzle ------------------------------------------------------------------------ jpizzle's Profile: http://www.excelforum.com/member.php...o&userid=23920 View this thread: http://www.excelforum.com/showthread...hreadid=382771 |
If find is true then.....
bump bump -- jpizzle ------------------------------------------------------------------------ jpizzle's Profile: http://www.excelforum.com/member.php...o&userid=23920 View this thread: http://www.excelforum.com/showthread...hreadid=382771 |
If find is true then.....
Sub macro() On Error Resume Next Cells.Find("test").Address If Err.Description < "" Then ' did not find the text 'your code Else 'found the text 'your code End If End Sub -- anilsolipuram ------------------------------------------------------------------------ anilsolipuram's Profile: http://www.excelforum.com/member.php...o&userid=16271 View this thread: http://www.excelforum.com/showthread...hreadid=382771 |
All times are GMT +1. The time now is 06:24 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com