Home |
Search |
Today's Posts |
#3
![]() |
|||
|
|||
![]()
Hello,
Thanks again. I can now go off and do something else within the script if nothing is found "FSt1" wrote: hi, if nothing was found, how do you trap nothing? add this to the code before the other msgboxes. If rng Is Nothing Then MsgBox rn & " was Not found." exit sub End If regards FSt1 "Alan" wrote: I use the code below to store a row number to a variable after a find. I would like to trap a NO FIND if the find is unsuccessfull Any ideas. FSt1 provided the code below Sub macfindrow() dim rn as string dim rng as range dim therow as long rn = inputbox("enter something to find") if rn < "" then Set rng = nothing Set rng = range("A1:IV65536").Find(what:=rn, _ After:=Range("A1"), _ Lookin:=xlformulas, _ Lookat:=xlpart, _ SearchOrder:=xlbyrows, _ SearchDirection:=xlNext, _ MatchCase:=false) end if therow = rng.row msgbox "Found at cell " & rng.address msbbox "The row number is " & therow end sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Find last occurance of text in range | Excel Worksheet Functions | |||
Find within Workbook. | Excel Discussion (Misc queries) | |||
How do I find the cell address of the 2nd largest of a set? | Excel Discussion (Misc queries) | |||
Using the Find tool in EXCEL | Excel Worksheet Functions | |||
Excel has a "Find Next" command but no "Find Previous" command. | Excel Discussion (Misc queries) |