Last cell VBA code. Are there limitations?

gaj104

Well-known Member
Joined
Nov 9, 2002
Messages
864
Hi,

Curious, is there any limitations of using this as my code to find the last used cell in a sheet?

Code:
Cells.Find("*", SearchDirection:=xlPrevious)

i.e the last row would be

Code:
Cells.Find("*", SearchDirection:=xlPrevious).Row

Thanks
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
You may want to specify all the other arguments too to control how the Find works eg if you lookin:=xlValues, then it won't find hidden rows (or filtered out ones) but if you use Lookin:=xlFormulas then it will find even filtered values.

Similarly, SearchOrder is useful to specify whether searching should be by rows or columns - either potentially giving you a substantially different result.
 
Upvote 0
Good to know. I'm updating various coding in excel 2003 sheets (where uses the "A65536".end(xlUP) method, and experimenting with the shortest code I can use.

Thanks Richard
 
Upvote 0

Forum statistics

Threads
1,222,095
Messages
6,163,901
Members
451,865
Latest member
dunworthc

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