Create Named Range in VBA

M

michael.a7

I would like to highlight a range of cells in my worksheet and then ru
a macro that will then create a Named Range using those highlighte
cells.

I suppose the VBA would be something like:
ThisWorkbook.Names.Add Name:="NewName", _
RefersTo:=

But I don't know what code is needed next. Can anyone help?

Many Thanks,
Michae
 
N

Norman Jones

Hi Michael,

Try:

'=============>>
Public Sub Tester()
Selection.Name = "YourName"
End Sub
'<<=============
 

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