Run Time Error 91 on Cell.Find

KnoxBear832

New Member
Joined
Aug 25, 2014
Messages
4
Using FIND in my code and getting a run-time error even with a ON ERROR GOTO line preceding the FIND line.

I'm trying to increase the row height of the cell that contains a particular text value. The sheet may or may not have that text and it's not always in the same cell, so I thought the ON ERROR / FIND combination would be best. I am using it multiple times in the macro and it seems to be working find, except for this last instance. What am I doing wrong??
Here is the code:

Code:
On Error GoTo Laststep    Cells.Find(What:="Sample Text", After:=ActiveCell, LookIn:=xlFormulas, _
        LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
        MatchCase:=False, SearchFormat:=False).Activate
    ActiveCell.RowHeight = 12.75
Laststep:
    Range("A2").Select
       
End Sub


I just tried this bit by itself and it seems to work fine. There must be something before this that interferes. Any ideas on what I may need to clear?
 
Last edited:

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.

JoeMo

MrExcel MVP
Joined
May 26, 2009
Messages
17,914
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
Here's another way that doesn't require error handling.

Code:
Dim R As Range

Set R = Cells.Find(What:="Sample Text", After:=ActiveCell, LookIn:=xlFormulas, _
        LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
        MatchCase:=False, SearchFormat:=False)
If Not R Is Nothing Then R.RowHeight = 12.75
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,593
Messages
5,838,257
Members
430,536
Latest member
Manoj Gaidhankar

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top