ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Give CurrentRegion a RangeName (https://www.excelbanter.com/excel-programming/432699-give-currentregion-rangename.html)

CLR

Give CurrentRegion a RangeName
 
Hi All.......

I would like to select a cell with code, say B14, and then be able to assign
a RangeName to it's "Current Region" without having to use cell references
for the Range because I never know how big the range will be for the
selected cell.

Any help would be appreciated.

Vaya con Dios,
Chuck, CABGx3




Gary''s Student

Give CurrentRegion a RangeName
 
Sub NameThatRegion()
Dim r As Range
Set r = ActiveCell.CurrentRegion
r.Name = "alphaa"
End Sub

--
Gary''s Student - gsnu200901

Rick Rothstein

Give CurrentRegion a RangeName
 
Why vector through the variable?

Sub NameThatRegion()
ActiveCell.CurrentRegion.Name = "alpha"
End Sub

--
Rick (MVP - Excel)


"Gary''s Student" wrote in message
...
Sub NameThatRegion()
Dim r As Range
Set r = ActiveCell.CurrentRegion
r.Name = "alphaa"
End Sub

--
Gary''s Student - gsnu200901



CLR

Give CurrentRegion a RangeName
 
"Works fine, lasts a long time"

Many thanks "Gary''s Student"

Vaya con Dios,
Chuck, CABGx3


"Gary''s Student" wrote in message
...
Sub NameThatRegion()
Dim r As Range
Set r = ActiveCell.CurrentRegion
r.Name = "alphaa"
End Sub

--
Gary''s Student - gsnu200901




CLR

Give CurrentRegion a RangeName
 
Nice improvement Rick........thanks


Vaya con Dios,
Chuck, CABGx3



"Rick Rothstein" wrote in message
...
Why vector through the variable?

Sub NameThatRegion()
ActiveCell.CurrentRegion.Name = "alpha"
End Sub

--
Rick (MVP - Excel)


"Gary''s Student" wrote in
message ...
Sub NameThatRegion()
Dim r As Range
Set r = ActiveCell.CurrentRegion
r.Name = "alphaa"
End Sub

--
Gary''s Student - gsnu200901






All times are GMT +1. The time now is 11:02 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com