A quick and easy question

  • Thread starter Thread starter Savannah_Alan
  • Start date Start date
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.
 
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
 
Back
Top