Muliple names in a range?

  • Thread starter Thread starter Cliff
  • Start date Start date
C

Cliff

Is it possible to have multiple named references within a range ID, for example:

Worksheets("Sheet1").Range("Year_1", "Year_3").Value = 0

where both Year_1 and Year_3 are named ranges themselves?

Cliff
 
You can use a union of the two ranges:

Option Explicit
Sub testme()
With Worksheets("sheet1")
Union(.Range("year_1"), .Range("year_3")).Value = 0
End With
End Sub

But this just seems more straightforward to me:

Option Explicit
Sub testme()
With Worksheets("sheet1")
.Range("year_1").Value = 0
.Range("year_3").Value = 0
End With
End Sub
 
Dave said:
You can use a union of the two ranges:

Option Explicit
Sub testme()
With Worksheets("sheet1")
Union(.Range("year_1"), .Range("year_3")).Value = 0
End With
End Sub

But this just seems more straightforward to me:

Option Explicit
Sub testme()
With Worksheets("sheet1")
.Range("year_1").Value = 0
.Range("year_3").Value = 0
End With
End Sub
Thanks, Dave...that works for me.
 
Back
Top