A quick and easy question

S

Savannah_Alan

Can you define named ranges having the same name on multiple sheets within
the same wookbook?
This is so that, for instance, I can use
"ActiveSheet.Range("NamedRange").Select"

Thanks in advance. Can't find it in the help files...

Alan.
 
D

Dave Peterson

Yep.

From the userinterface:
Select your range
Insert|name|define
In the names in workbook box, just type the name of the worksheet, exclamation
point, and the name for the range:

sheet1!myName1
or
'sheet 2'!myName1

One way in code:

Option Explicit
Sub test02()
With Worksheets("sheet7")
.Range("a2:b22").Name = "'" & .Name & "'!myName1"
End With
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top