Assign a Name to a Range in VBA
I would like to be able to assign a name to a range in VBA. For example:
Sub mac2()
Dim r As Range
Set r = Cells(1, 1)
For i = 2 To 10
If Not IsEmpty(Cells(i, i).Value) Then
Set r = Union(r, Cells(i, i))
End If
Next
r.Select
ActiveWorkbook.Names.Add Name:="diagonal", RefersToR1C1:= ?????????
End Sub
By Naming a range I can make it available to worksheet functions.
--
Gary''s Student
|