Name a range based on worksheet/tab name

Lefemmenikita

Board Regular
Joined
Jan 28, 2014
Messages
59
Office Version
  1. 2013
Platform
  1. Windows
Hi


I have recorded a macro to see the code to do this though am stuck.


I am trying to create a named range in a worksheet, for a data range that changes monthly.

I want the name of the named range to be based on the name of the worksheet the data resides in.



For example, if the worksheet is named 'sheet1', I want the named range (cells A1; last used row & column) to be called 'sheet1'


Is there a way to do that via vba?


The problem is at the moment, the only way that I am able to 'extract' the name of the worksheet is by double clicking the tab name and copying & pasting it into the named range field.

I want to automate it so that the named range automatically picks up the worksheet/tab name


Thanks

Named_Range.png
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Hi Lefemmenikita,
how far did you get with your VBA? Did you already record/build something? If so, please post it here (in [CODE][/CODE] brackets).
Thanks,
Koen
 
Upvote 0
Hi. No I didn't manage to get a code to work. the issue is still around how to get the vba to recognise the name of the sheet without having to double click the tab name
 
Upvote 0

Forum statistics

Threads
1,215,710
Messages
6,126,396
Members
449,312
Latest member
sweetfriend9

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