ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Create Named Range in VBA (https://www.excelbanter.com/excel-programming/363767-create-named-range-vba.html)

michael.a7[_5_]

Create Named Range in VBA
 

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

--
michael.a
-----------------------------------------------------------------------
michael.a7's Profile: http://www.excelforum.com/member.php...fo&userid=3302
View this thread: http://www.excelforum.com/showthread.php?threadid=55014


Norman Jones

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




michael.a7[_6_]

Create Named Range in VBA
 

Thanks Norman :)


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



All times are GMT +1. The time now is 04:19 AM.

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