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
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
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.
Dynamic Range 1 would be D36: D(x)
Dynamic Range 2 would be D(X+10):D
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.