ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Defining Names (https://www.excelbanter.com/excel-programming/272620-defining-names.html)

russell \(skmr3\)

Defining Names
 
Hi All,

I have a listing i'd like to give a name. As the listing
has a heading, i cant use the currentregion option when
defining the name.
I.e.
No. SuppN SuppNo
1 ABBCD 10012
2 HJUTH 2704
etc etc

The listing itself is currently selected (no headings
included).
Can anyone help me modify the below coding so the current
selection is defined?

ActiveWorkbook.Names.Add Name:="SuppTbl", _
RefersTo:=ActiveWorkbook.Worksheets("Supps").Selec tion

Thanks in advance.

Russell.

Matthew Connor

Defining Names
 
russell (skmr3) wrote:

Hi All,

<snip
Can anyone help me modify the below coding so the current
selection is defined?

ActiveWorkbook.Names.Add Name:="SuppTbl", _
RefersTo:=ActiveWorkbook.Worksheets("Supps").Selec tion

Thanks in advance.

Russell.

'Selection' is only available for the Application and Window objects.

Either:
ActiveWorkbook.Names.Add Name:="SuppTbl", _
RefersTo:=ActiveWindow.Selection

ActiveWorkbook.Names.Add Name:="SuppTbl", _
RefersTo:=Application.Selection

might suit your needs.

HTH,

Matthew Connor



All times are GMT +1. The time now is 04:17 PM.

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