Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I've been trying to get the following code to work in Excel 2003. It's fine
if X is found. It breaks on the X assignment statement if Cells.Find fails to find anything. The error is *always*: Object variable or With block variable not set (Error 91) I've tried it with and without using the "set" in front of the X assignment, with and without declaring DIM X, alternately as Object and as Range Range("A1").Select x = Cells.Find(What:=",", After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _ xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _ , SearchFormat:=False).Activate If (x Is Nothing) Then MsgBox "Not Found" Else MsgBox "x is " & x End If So, while it works okay with the "On Error Resume Next" statement inserted, I must be doing something wrong for it to generate a stop execution error...I'd like to find out what is the proper way of doing this. Can anyone give me a clue? Thanks |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Need Cells.find to find first number in a row which is 8000 | Excel Discussion (Misc queries) | |||
how to find cells that refer to data in other cells in excel | Excel Discussion (Misc queries) | |||
from a group of cells.find average of cells containing values | Excel Discussion (Misc queries) | |||
How to find multiple cells/replace whole cells w/data | Excel Discussion (Misc queries) | |||
If Cells.Find can't find anything | Excel Programming |