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

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
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
 
Upvote 0

Forum statistics

Threads
1,213,535
Messages
6,114,192
Members
448,554
Latest member
Gleisner2

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
Back
Top