View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Create Named Range in VBA

Hi Michael,

Try:

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


---
Regards,
Norman


"michael.a7" wrote
in message ...

I would like to highlight a range of cells in my worksheet and then run
a macro that will then create a Named Range using those highlighted
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,
Michael


--
michael.a7
------------------------------------------------------------------------
michael.a7's Profile:
http://www.excelforum.com/member.php...o&userid=33027
View this thread: http://www.excelforum.com/showthread...hreadid=550149