Macro to edit Range Name
Hi Eric,
One way, perhaps:
'=============
Public Sub Tester01()
Dim RngA As Range
Dim RngB As Range
Dim RngC As Range
Dim RngD As Range
Const sStr As String = "A4"
With Range(sStr)
Set RngA = .CurrentRegion.Columns(1)
Set RngB = .CurrentRegion.Columns(2)
Set RngC = .CurrentRegion.Columns(3)
Set RngD = .CurrentRegion.Columns(4)
End With
End Sub
'<<=============
---
Regards,
Norman
wrote in message
oups.com...
I'm still fiddling with this and thought I had the answer. The range
should just be the data in a particular column. When I use the
following macro, the range ends up being ALL of the data on the sheet.
Any ideas what I am doing wrong?
Sheets("Sheet2").Select
Range("A4").Select
Range(Selection, Selection.End(xlDown)).Select
Range("rangea").CurrentRegion.Name = "rangea"
Range("B4").Select
Range(Selection, Selection.End(xlDown)).Select
Range("rangeb").CurrentRegion.Name = "rangeb"
Range("C4").Select
Range(Selection, Selection.End(xlDown)).Select
Range("rangec").CurrentRegion.Name = "rangec"
Range("D4").Select
Range(Selection, Selection.End(xlDown)).Select
Range("ranged").CurrentRegion.Name = "ranged"
|