+ Reply to Thread
Results 1 to 4 of 4

referring to names

  1. #1
    TxRaistlin
    Guest

    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

  2. #2
    Tom Ogilvy
    Guest

    Re: referring to names

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


    where "name1" represents the name of interest.

    --
    Regards,
    Tom Ogilvy

    "TxRaistlin" <TxRaistlin@discussions.microsoft.com> wrote in message
    news:06AF123D-1ECC-4667-9926-C23022B423E2@microsoft.com...
    > 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




  3. #3
    TxRaistlin
    Guest

    Re: 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" <TxRaistlin@discussions.microsoft.com> wrote in message
    > news:06AF123D-1ECC-4667-9926-C23022B423E2@microsoft.com...
    > > 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

    >
    >
    >


  4. #4
    Bob Phillips
    Guest

    Re: 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" <TxRaistlin@discussions.microsoft.com> wrote in message
    news:06AF123D-1ECC-4667-9926-C23022B423E2@microsoft.com...
    > 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




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1