find bottom of range with value

SamS

Well-known Member
Joined
Feb 17, 2002
Messages
542
I have a table which has formulas throughout. In the past to find the end of a table I used
Range("A2").End(xlDown).Select or
Range("A65536").End(xlUp).Select depending on the occasion. The problem I am having with these at the moment is that this code finds the last cell with a formula where as I specifically want the last row that has returned a value. Any ideas?
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Hi SamS,

There is no equivalent method to the End method for finding cells that contain a null value (and incidentally, a cell with a formula is not considered 'Empty' by the IsEmpty function). As a result, some extra code is required. To do the equivalent of

[a65536].End(xlUp).Select

use this code:

Dim C As Range
Set C = [a65536].End(xlUp)
Do While C = "" And C.Row > 1
Set C = C.Offset(-1)
Loop
C.Select
 
Upvote 0
Thanks Damon, I was hoping that there may have been something I was missing, seems not.
 
Upvote 0

Forum statistics

Threads
1,214,523
Messages
6,120,039
Members
448,940
Latest member
mdusw

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