Defining Names

  • Thread starter Thread starter russell \(skmr3\)
  • Start date Start date
R

russell \(skmr3\)

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").Selection

Thanks in advance.

Russell.
 
russell said:
Can anyone help me modify the below coding so the current
selection is defined?

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

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
 
Back
Top