E
Edward Ulle
I am having a problem with the Find method of Range.
I have a macro that searches a worksheet using the Find method for a
particular value in column 1. Normally it will find the value and
return the range. However, sometimes when I rerun the macro and its
search for the same value it won't find it and returns nothing.
I have traced the execution and can see the value that it is search for
and I am certain that value exists in the range of the first column.
I'm using Find and not FindNext so I'm assuming every call to Find
resets to the top of the column and search down until found or not.
I have cut out three of the lines from the macro to show the exact
syntax I am using. Both ranges rJoints and rElements contain formulas
so I'm looking for values.
Set rJoints = wsPlotsheet.Columns(53) ' Column BA
Set rElements = Worksheets("Elements").Range("A1")
Set rFind = rJoints.Find(What:=rElements.Offset(i, 2), LookIn:=xlValues,
LookAt:=xlWhole)
To illustrate what the macro does is, it generates graphics with text
associates with each shape. I run the macro and it creates a new
worksheet with the graphics and associated text representing an
attribute. It works. I simply rerun the macro requesting the same
graphics but with a different attribute. The graphics should be
identical only the attribute changes. But it doesn't work, and I've
trace it to the Find method. It found the values the first time I run
but doesn't find the same value the next time.
Any suggestions would be appreciated.
*** Sent via Developersdex http://www.developersdex.com ***
I have a macro that searches a worksheet using the Find method for a
particular value in column 1. Normally it will find the value and
return the range. However, sometimes when I rerun the macro and its
search for the same value it won't find it and returns nothing.
I have traced the execution and can see the value that it is search for
and I am certain that value exists in the range of the first column.
I'm using Find and not FindNext so I'm assuming every call to Find
resets to the top of the column and search down until found or not.
I have cut out three of the lines from the macro to show the exact
syntax I am using. Both ranges rJoints and rElements contain formulas
so I'm looking for values.
Set rJoints = wsPlotsheet.Columns(53) ' Column BA
Set rElements = Worksheets("Elements").Range("A1")
Set rFind = rJoints.Find(What:=rElements.Offset(i, 2), LookIn:=xlValues,
LookAt:=xlWhole)
To illustrate what the macro does is, it generates graphics with text
associates with each shape. I run the macro and it creates a new
worksheet with the graphics and associated text representing an
attribute. It works. I simply rerun the macro requesting the same
graphics but with a different attribute. The graphics should be
identical only the attribute changes. But it doesn't work, and I've
trace it to the Find method. It found the values the first time I run
but doesn't find the same value the next time.
Any suggestions would be appreciated.
*** Sent via Developersdex http://www.developersdex.com ***