To add a range name based on a selection using a variable : Range Add « Excel « VBA / Excel / Access / Word






To add a range name based on a selection using a variable

 

Sub AddName3()
    Dim rngSelect As String
    rngSelect = Selection.Address
    ActiveSheet.Names.Add Name:="MyRange3", RefersTo:="=" & rngSelect
End Sub

 








Related examples in the same category

1.To add a range name for known range
2.To add a range name based on a selection
3.Use ActiveCell and ActiveCell.End to create Range