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

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.

Damon Ostrander

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

SamS

Well-known Member
Joined
Feb 17, 2002
Messages
542
Thanks Damon, I was hoping that there may have been something I was missing, seems not.
 

Forum statistics

Threads
1,144,310
Messages
5,723,640
Members
422,506
Latest member
mdindas

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