Dynamic Ranges

dtp81390

New Member
Joined
Oct 26, 2015
Messages
37
I am trying to write a formula for a dynamic range which has a definite starting point D36 but has no end point. (I have a macro that inserts a new row at the end of Dynamic Range 1 when the user clicks a button). However, There will be another set of data on the same sheet which needs a dynamic range.

Dynamic Range 1 would be D36: D(x)
Dynamic Range 2 would be D(X+10):D(y)

I want to use the Index formula to handle the range rather than the OFFSET command.

In VBA there is the CurrentRegion function that goes until it finds a blank in the indicated column and then I can offest the start value for the next range and use the current region to get the end of this range.

This would be the code to do this
Code:
Set Res1Start = Range("B10")Set Res1 = Res1Start.CurrentRegion


Set Res2Start = Range("B" & Res1.Rows(Res1.Rows.Count).Row + 2)
Set Res2 = Res2Start.CurrentRegion

Is there anyway to do this with a formula in the named ranges, if not how can I use VBA to then assign this range to a named range and have it update automatically.
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).

Forum statistics

Threads
1,215,063
Messages
6,122,930
Members
449,094
Latest member
teemeren

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