named range in

G

Guest

Hi All

Hoping someone can point me in the right direction with this? I need to
modify the following statment to refer to the CurrentRegion.

ActiveWorkbook.Names.Add Name:="Renewal_Report", RefersToR1C1:= _
"=Reports!R5C1:R17C13"

as the Current region will change with every entry, the above is not
appropriate.

Any Idea's?
Thanks in Advance
Steve
 
G

Guest

The following code will work, but only if there is at least one blank row
between regions:

Sub NameCurrentRegion()

Selection.CurrentRegion.Select
Selection.Name = "MyRegion"

End Sub
 
G

Guest

even simpler (no need to select)

Sub NameCurrentRegion()

Worksheets("Reports").Range("A5").CurrentRegion = _
"Renewal_Report"


End Sub
 
G

Guest

thanks for both replies - both work

Tom Ogilvy said:
even simpler (no need to select)

Sub NameCurrentRegion()

Worksheets("Reports").Range("A5").CurrentRegion = _
"Renewal_Report"


End Sub
 
G

Guest

Tom I think your code should read
Worksheets("Reports").Range("A5").CurrentRegion.Name = _
"Renewal_Report"

But I could be wrong?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top