Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Creating NamedRanges with VBA

Im having difficulty in creating a named range programmatically and getting
it to appear in the goto box. The following code DOES create a named range,
but the refference has quotes around it and therefore does not appear in the
goto box.

Does anyone know what I am doing wrong ?

Dim mr As String
mr = "Sheet1!myRange3"
'Create Range
Call ThisWorkbook.Names.Add(Name:=mr, RefersTo:="Sheet1!$A$1:$C$3",
Visible:=True)



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Creating NamedRanges with VBA

Sorry should have read


Dim mr As String
mr = "Sheet1!$A$1:$C$3",
'Create Range
Call ThisWorkbook.Names.Add(Name:="myRange", RefersTo:=mr,
Visible:=True)


"Goofy" wrote in message
...
Im having difficulty in creating a named range programmatically and
getting it to appear in the goto box. The following code DOES create a
named range, but the refference has quotes around it and therefore does
not appear in the goto box.

Does anyone know what I am doing wrong ?

Dim mr As String
mr = "Sheet1!myRange3"
'Create Range
Call ThisWorkbook.Names.Add(Name:=mr, RefersTo:="Sheet1!$A$1:$C$3",
Visible:=True)





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Creating NamedRanges with VBA

ItsOK, I worked it out, there should have been an equal sign before the
reference


"Goofy" wrote in message
...
Sorry should have read


Dim mr As String
mr = "Sheet1!$A$1:$C$3",
'Create Range
Call ThisWorkbook.Names.Add(Name:="myRange", RefersTo:=mr,
Visible:=True)


"Goofy" wrote in message
...
Im having difficulty in creating a named range programmatically and
getting it to appear in the goto box. The following code DOES create a
named range, but the refference has quotes around it and therefore does
not appear in the goto box.

Does anyone know what I am doing wrong ?

Dim mr As String
mr = "Sheet1!myRange3"
'Create Range
Call ThisWorkbook.Names.Add(Name:=mr, RefersTo:="Sheet1!$A$1:$C$3",
Visible:=True)







  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Creating NamedRanges with VBA

Simpler


worksheets("Sheet1").Range("$A$1:$C$3").Name = "myRange"

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Goofy" wrote in message
...
ItsOK, I worked it out, there should have been an equal sign before the
reference


"Goofy" wrote in message
...
Sorry should have read


Dim mr As String
mr = "Sheet1!$A$1:$C$3",
'Create Range
Call ThisWorkbook.Names.Add(Name:="myRange", RefersTo:=mr,
Visible:=True)


"Goofy" wrote in message
...
Im having difficulty in creating a named range programmatically and
getting it to appear in the goto box. The following code DOES create a
named range, but the refference has quotes around it and therefore does
not appear in the goto box.

Does anyone know what I am doing wrong ?

Dim mr As String
mr = "Sheet1!myRange3"
'Create Range
Call ThisWorkbook.Names.Add(Name:=mr, RefersTo:="Sheet1!$A$1:$C$3",
Visible:=True)









  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Creating NamedRanges with VBA

Thanks bob


"Bob Phillips" wrote in message
...
Simpler


worksheets("Sheet1").Range("$A$1:$C$3").Name = "myRange"

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Goofy" wrote in message
...
ItsOK, I worked it out, there should have been an equal sign before the
reference


"Goofy" wrote in message
...
Sorry should have read


Dim mr As String
mr = "Sheet1!$A$1:$C$3",
'Create Range
Call ThisWorkbook.Names.Add(Name:="myRange", RefersTo:=mr,
Visible:=True)


"Goofy" wrote in message
...
Im having difficulty in creating a named range programmatically and
getting it to appear in the goto box. The following code DOES create a
named range, but the refference has quotes around it and therefore
does
not appear in the goto box.

Does anyone know what I am doing wrong ?

Dim mr As String
mr = "Sheet1!myRange3"
'Create Range
Call ThisWorkbook.Names.Add(Name:=mr, RefersTo:="Sheet1!$A$1:$C$3",
Visible:=True)











Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
creating Yes,No Amin Excel Discussion (Misc queries) 3 November 8th 08 10:02 PM
Creating Id shail Excel Worksheet Functions 8 September 14th 06 06:30 PM
Really need help creating pop ups mward77095 Excel Discussion (Misc queries) 3 May 8th 06 09:34 PM
ClearContents - Except NamedRanges Mike Fogleman Excel Programming 8 September 2nd 04 01:19 AM
Creating an XLL with C# Jon Anderson Excel Programming 1 May 26th 04 09:02 AM


All times are GMT +1. The time now is 05:17 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"