Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
With the help of others, I have the following macro that allows me to take a
list of words, and find them in worksheet. The problem I am having is when the search comes to a word that it does not find, it errors. Any help you can provide would be appreciated. Sub FindValues() Dim myC As Range Dim myD As Range Dim myR As Range Dim myL As Range Dim myFindString As String Dim firstAddress As String Set myL = Worksheets("Search").Range("A2") Set myL = Range(myL, myL.End(xlDown)) 'Worksheet "Search" and begining cell "A2" ID's words to search for. For Each myR In myL myFindString = myR.Value With Worksheets("data").Cells 'Worksheet "data" to be searched. Set myC = .Find(myFindString, LookIn:=xlValues, lookAt:=xlPart) If Not myC Is Nothing Then Set myD = myC firstAddress = myC.Address End If Set myC = .FindNext(myC) If Not myC Is Nothing And myC.Address < firstAddress Then Do Set myD = Union(myD, myC) Set myC = .FindNext(myC) Loop While Not myC Is Nothing And myC.Address < firstAddress End If End With 'Format statement myD.Interior.ColorIndex = 3 Set myC = Nothing Set myD = Nothing Next myR End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Error dialog box meaning and how to find error | Excel Worksheet Functions | |||
I tried to get around the problem of the pivot table field settingdefaulting to Count instead of Sum by running a macro of change the settingfrom Count to Sum. However, when I tried to run the Macro, I got error messageof run time error 1004, unable | Excel Worksheet Functions | |||
I tried to get around the problem of the pivot table field settingdefaulting to Count instead of Sum by running a macro of change the settingfrom Count to Sum. However, when I tried to run the Macro, I got error messageof run time error 1004, unable | Excel Discussion (Misc queries) | |||
"Can't find macro" error | New Users to Excel | |||
help with this error-Compile error: cant find project or library | Excel Discussion (Misc queries) |