Home |
Search |
Today's Posts |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Something like this should do...
Sub FindAll() Call FindStuff(Sheets("Sheet1"), "This") 'change to suit Call FindStuff(Sheets("Sheet2"), "This") End Sub Sub FindStuff(ByVal wks As Worksheet, ByVal strToFind As String) Dim rngFound As Range Dim rngFoundAll As Range Dim rngToSearch As Range Dim strFirstAddress As String Set rngToSearch = wks.Range("A:A") 'change to suit Set rngFound = rngToSearch.Find(What:=strToFind, _ LookAt:=xlWhole, _ LookIn:=xlFormulas, _ MatchCase:=False) If rngFound Is Nothing Then MsgBox strToFind & " could not be found in " & wks.Name Else Set rngFoundAll = rngFound strFirstAddress = rngFound.Address Do Set rngFoundAll = Union(rngFound, rngFoundAll) Set rngFound = rngToSearch.FindNext(rngFound) Loop Until rngFound.Address = strFirstAddress MsgBox rngFoundAll.Address(External:=True) End If End Sub -- HTH... Jim Thomlinson "LuisE" wrote: I need to perform a "Find" search in two sheets and then show the addresses of the matches in a MsgBox. I'm running XL2000 ( No Potions in the Find dialogbox) I think I can create an array with the results and then show each element as a line in the MsgBox, problem: I don't know how to do it.... Thanks in advance |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell | Excel Discussion (Misc queries) | |||
How do I find the "Show Pages..." Pivot table feature in 2007? | Excel Discussion (Misc queries) | |||
Best way to trap error to MsgBox "Too many cell formats" | Excel Discussion (Misc queries) | |||
HELP on "left","right","find","len","substitute" functions | Excel Discussion (Misc queries) | |||
if "a" selected from dropdown menu then show "K" in other cell | Excel Worksheet Functions |