ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   referring to names (https://www.excelbanter.com/excel-programming/336028-referring-names.html)

TxRaistlin

referring to names
 
Hi all,

I have the following bit of code in Excell 2002 that adds names based on two
columns, the first with the reference name and the second the value for the
name.

Do While Cells(i + 1, 1) < ""
ActiveWorkbook.Names.Add Name:=Cells(i + 1, 1), RefersToR1C1:= _
"=InputParameters!R" & i + 1 & "C2"
i = i + 1
Loop

How would you reference one of the added names in VB?

A simple check, such as msgbox name_here, returns a variable not defined
error.

Thanks,

Jason

Tom Ogilvy

referring to names
 
msgbox Range("name1").Address & ", " & Range("name1").value


where "name1" represents the name of interest.

--
Regards,
Tom Ogilvy

"TxRaistlin" wrote in message
...
Hi all,

I have the following bit of code in Excell 2002 that adds names based on

two
columns, the first with the reference name and the second the value for

the
name.

Do While Cells(i + 1, 1) < ""
ActiveWorkbook.Names.Add Name:=Cells(i + 1, 1), RefersToR1C1:= _
"=InputParameters!R" & i + 1 & "C2"
i = i + 1
Loop

How would you reference one of the added names in VB?

A simple check, such as msgbox name_here, returns a variable not defined
error.

Thanks,

Jason




TxRaistlin

referring to names
 
Thanks! That was exactly what I was looking for.

Jason

"Tom Ogilvy" wrote:

msgbox Range("name1").Address & ", " & Range("name1").value


where "name1" represents the name of interest.

--
Regards,
Tom Ogilvy

"TxRaistlin" wrote in message
...
Hi all,

I have the following bit of code in Excell 2002 that adds names based on

two
columns, the first with the reference name and the second the value for

the
name.

Do While Cells(i + 1, 1) < ""
ActiveWorkbook.Names.Add Name:=Cells(i + 1, 1), RefersToR1C1:= _
"=InputParameters!R" & i + 1 & "C2"
i = i + 1
Loop

How would you reference one of the added names in VB?

A simple check, such as msgbox name_here, returns a variable not defined
error.

Thanks,

Jason





Bob Phillips[_6_]

referring to names
 
Depends upon what is in Cells(I+1,1), but it would be something like

Range("the_Value").Value

--

HTH

RP
(remove nothere from the email address if mailing direct)


"TxRaistlin" wrote in message
...
Hi all,

I have the following bit of code in Excell 2002 that adds names based on

two
columns, the first with the reference name and the second the value for

the
name.

Do While Cells(i + 1, 1) < ""
ActiveWorkbook.Names.Add Name:=Cells(i + 1, 1), RefersToR1C1:= _
"=InputParameters!R" & i + 1 & "C2"
i = i + 1
Loop

How would you reference one of the added names in VB?

A simple check, such as msgbox name_here, returns a variable not defined
error.

Thanks,

Jason





All times are GMT +1. The time now is 05:28 PM.

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