![]() |
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) |
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) |
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) |
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) |
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) |
All times are GMT +1. The time now is 03:00 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com