Macro works but error still shows up.

Sebastian

New Member
Joined
Sep 17, 2002
Messages
32
OK' I can find the last used cell in a column but only when I know which column it is (A, B, C etc).
I want to search for a particular word "Late" (I know it only appears once in the sheet) and then find the last cell in that column.
The following seems to work but although the correct cell gets selected I still get an error (Method 'Range' of object'_Global' failed)

Sub MyMacro()
Cells.Find(What:="Late", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
Range("Late").Offset(65532, 0).End(xlUp).Select
End Sub
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
On 2002-09-22 21:43, Sebastian wrote:
OK' I can find the last used cell in a column but only when I know which column it is (A, B, C etc).
I want to search for a particular word "Late" (I know it only appears once in the sheet) and then find the last cell in that column.
The following seems to work but although the correct cell gets selected I still get an error (Method 'Range' of object'_Global' failed)

Sub MyMacro()
Cells.Find(What:="Late", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
Range("Late").Offset(65532, 0).End(xlUp).Select
End Sub

This one worked for me....so one way would be

</pre>
Sub MyMacro()
Cells.Find(What:="Late", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False).Activate
Cells(65536, ActiveCell.Column).End(xlUp).Select
End Sub
</pre>
 
Upvote 0

Forum statistics

Threads
1,215,014
Messages
6,122,697
Members
449,092
Latest member
snoom82

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