Adjusting Named Ranges Dynamically

jkwleisemann

New Member
Joined
May 31, 2016
Messages
19
Good morning, everybody!

I have to update a *ton* of tables in an Excel spreadsheet, rolling them forward for the new year. For example, if WRSState is in cells A6:H15, I need to copy rows A7:H15 into A6:H14, clear A15:H15, and then make a couple of other edits that i should be able to figure out.

But I've got about 50 tables, so I'd really rather not do this manually. And they're spread out over a lot of different worksheets.

The sort of thing that should be a macro, I think.

What I'm trying to figure out is how I can set up things like referencing the final row, referencing the final column, that type of thing. I'm pretty sure that I can do things like:

Code:
Range("Name").cells(R1C0, R?C?)

But I'm not sure how to fill in the "?" in that.

Also, I'd like to try and iterate through the named ranges, rather than have to type out each one. Can i do something like this?

Code:
For i = 1 to Worksheets.Count
For Each Range in Worksheets(i)
(Code and stuff)
Next
Next

Or is there some other way to set this up?

Or should I just start keying and stop trying to be cute about how I do it?
 
Last edited:

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Hi, Better late than never!

I use this type:

=OFFSET(Plan2!$A$2,0,0,COUNTA(Plan2!$A:$A)-1)

This formula is inserted in the window opened with CTRL + F3.

In your case, rename the columns.
 
Upvote 0
To reference the last row of a named range, you could use the .Rows property, as in

Code:
With Range("namedRange")
    MsgBox .Rows(.Rows.Count).Address
End With
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,170
Members
453,021
Latest member
Justyna P

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