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

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

Ivan F Moala

MrExcel MVP
Joined
Feb 10, 2002
Messages
4,209
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>
 

Forum statistics

Threads
1,144,122
Messages
5,722,604
Members
422,447
Latest member
knopp

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