View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Robert AS Robert AS is offline
external usenet poster
 
Posts: 3
Default ERROR 91 with FIND in macro

I can't seem to get around a ERROR 91 message when I make a macro loop with a
FIND function.....any ideas on how to correct this sort of error would be
welcome. I know the data is present and I know it has to be just as it looks
rounded values will not work, I also know it can be part of the cell content.
I'm looking over a full sheet.

A good way to test this would be to place some number of RAND numbers within
a sheet and use the MIN function to find the least......use the FIND function
within a macro to find the least number and select and remove that so it
looks for the next higher value....repeat

Before responding please test your idea€¦.Ive been given over 100 bad ideas
to date, (with in 1 week)

As far as I can tell the FIND is looking for part of a string and I
understand the 91 ERROR to be some sort of SET value error.

The macro should look something like this with the data in sheet 1 and the
MIN function in sheet 2

Starting in sheet 2 active cell and ending in same.......recorded in relative

ActiveCell.Select
Selection.Copy
ActiveCell.Offset(1, 0).Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Sheets("Sheet1").Select
ActiveCell.Cells.Select
Selection.Find(What:="0.110937", After:=ActiveCell, LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
ActiveCell.Select
Application.CutCopyMode = False
Selection.ClearContents
Sheets("Sheet2").Select
ActiveCell.Offset(-1, 0).Range("A1").Select