Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Problem creating a named range
Code looks like this:
ActiveWorkbook.Names.Add Name:=varName, RefersTo:="Sheet!" & varStartCell Creates a name, which I cannot use, because it is surrounded by quotation " " symbols. Note about Varname: is created after stripping out spaces from user entered input; varStartCell is an absolute reference like $A$5 TY |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Problem creating a named range
Do you have a worksheet named: Sheet
And you dropped an equal sign in the refersto:= portion RefersTo:="=Sheet!" & varStartCell headly wrote: Code looks like this: ActiveWorkbook.Names.Add Name:=varName, RefersTo:="Sheet!" & varStartCell Creates a name, which I cannot use, because it is surrounded by quotation " " symbols. Note about Varname: is created after stripping out spaces from user entered input; varStartCell is an absolute reference like $A$5 TY -- Dave Peterson |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Problem creating a named range
On Sun, 27 Jul 2008 16:49:29 -0700, headly
wrote: Code looks like this: ActiveWorkbook.Names.Add Name:=varName, RefersTo:="Sheet!" & varStartCell Creates a name, which I cannot use, because it is surrounded by quotation " " symbols. Note about Varname: is created after stripping out spaces from user entered input; varStartCell is an absolute reference like $A$5 TY You're very close to the correct format. Note the equal sign AFTER the initial quote. ActiveWorkbook.Names.Add Name:=varName, RefersTo:="=Sheet!" & varStartCell --ron |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Problem creating a named range
On Jul 27, 5:48 pm, Dave Peterson wrote:
Do you have a worksheet named: Sheet And you dropped an equal sign in the refersto:= portion RefersTo:="=Sheet!" & varStartCell headly wrote: Code looks like this: ActiveWorkbook.Names.Add Name:=varName, RefersTo:="Sheet!" & varStartCell Creates a name, which I cannot use, because it is surrounded by quotation " " symbols. Note about Varname: is created after stripping out spaces from user entered input; varStartCell is an absolute reference like $A$5 TY -- Dave Peterson Hello headly, If you need the active sheet's name added to the reference, you can use this code.. ActiveWorkbook.Names.Add Name:=varName, RefersTo:="='" & ActiveSheet.Name & "'!" & varStartCell Sincerely, Leith Ross |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Problem creating a named range
You are missing an equals sign:
Sub Macro1() Dim varName As String Dim varStartCell As String varName = "alpha" varStartCell = "$A$5" ActiveWorkbook.Names.Add Name:=varName, RefersTo:="=Sheet!" & varStartCell End Sub -- Gary''s Student - gsnu200796 "headly" wrote: Code looks like this: ActiveWorkbook.Names.Add Name:=varName, RefersTo:="Sheet!" & varStartCell Creates a name, which I cannot use, because it is surrounded by quotation " " symbols. Note about Varname: is created after stripping out spaces from user entered input; varStartCell is an absolute reference like $A$5 TY |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Problem creating a named range
Actually, no, I get a name like ="sheet1!$A$5" but no idea where the "" came
from "Gary''s Student" wrote: You are missing an equals sign: Sub Macro1() Dim varName As String Dim varStartCell As String varName = "alpha" varStartCell = "$A$5" ActiveWorkbook.Names.Add Name:=varName, RefersTo:="=Sheet!" & varStartCell End Sub -- Gary''s Student - gsnu200796 "headly" wrote: Code looks like this: ActiveWorkbook.Names.Add Name:=varName, RefersTo:="Sheet!" & varStartCell Creates a name, which I cannot use, because it is surrounded by quotation " " symbols. Note about Varname: is created after stripping out spaces from user entered input; varStartCell is an absolute reference like $A$5 TY |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Problem creating a named range
Put a stop in your code just before naming the range like the following then
while it is stopped and before cancelling the process, rest your cursor over the variables varName and then varStartCell and see what value VBA has assigned to them. varName = "MyNamedRange" 'Just as demo. No doubt your code is different varStartCell = "$A$5" Stop ActiveWorkbook.Names.Add Name:=varName, RefersTo:="Sheet!" & varStartCell If you can't fix then post a bit more of your code showing how varName and varStartCell are populated and manipulated. ie stipped of blanks etc. -- Regards, OssieMac "headly" wrote: Actually, no, I get a name like ="sheet1!$A$5" but no idea where the "" came from "Gary''s Student" wrote: You are missing an equals sign: Sub Macro1() Dim varName As String Dim varStartCell As String varName = "alpha" varStartCell = "$A$5" ActiveWorkbook.Names.Add Name:=varName, RefersTo:="=Sheet!" & varStartCell End Sub -- Gary''s Student - gsnu200796 "headly" wrote: Code looks like this: ActiveWorkbook.Names.Add Name:=varName, RefersTo:="Sheet!" & varStartCell Creates a name, which I cannot use, because it is surrounded by quotation " " symbols. Note about Varname: is created after stripping out spaces from user entered input; varStartCell is an absolute reference like $A$5 TY |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Problem creating a named range
On Sun, 27 Jul 2008 18:27:02 -0700, headly
wrote: Actually, no, I get a name like ="sheet1!$A$5" but no idea where the "" came from If you put in the "=" sign where we have all been telling you to, those "" will go away. --ron |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Creating a named range? | Excel Discussion (Misc queries) | |||
Problem with creating a named range | Excel Programming | |||
Creating a named range | Excel Programming | |||
Can I use named range in data range box when creating pie chart? | Charts and Charting in Excel | |||
Creating a Named Range using VB | Excel Programming |