+ Reply to Thread
Results 1 to 4 of 4

trouble selecting a named cell

  1. #1
    john foster
    Guest

    trouble selecting a named cell

    I have a column of cells named/labelled in series thus: _17548, _17549 and
    so on.

    I have a cell on another sheet whose value will be, depending on whatever
    conditions, one of these values.

    I need to paste the value of the correspondingly named cell on the first
    sheet to another cell on the second.

    I am having major difficulty doing this, I try to assign the value of the
    source cell as a variable and then paste the contents of the cell with that
    name to the target cell, but it just won't accept the "name" of the cell as a
    range type variable. It will accept it as a string, but i can't seem to get
    it to accept a string variable in a line such as :-
    range("variable_name").select

    HELP
    I hope i've made this clear for you all,
    is there a way around this?
    Thanks in advance
    John Foster

  2. #2
    Norman Jones
    Guest

    Re: trouble selecting a named cell

    Hi John,

    Try:

    Dim Rng As Range

    Rng = Range( "_17548")

    Sheets("Sheet2").Range("A1").Value = Rng.Value

    Note that if you use a range variable, an expression like:

    > range("variable_name").


    will cause an error: the variable, e.g. Rng, refers to a range, so the use
    of :

    > range


    is incorrect.


    ---
    Regards,
    Norman


    "john foster" <johnfoster@discussions.microsoft.com> wrote in message
    news:58C17503-7738-450E-8258-FD242D8925DE@microsoft.com...
    >I have a column of cells named/labelled in series thus: _17548, _17549
    >and
    > so on.
    >
    > I have a cell on another sheet whose value will be, depending on whatever
    > conditions, one of these values.
    >
    > I need to paste the value of the correspondingly named cell on the first
    > sheet to another cell on the second.
    >
    > I am having major difficulty doing this, I try to assign the value of the
    > source cell as a variable and then paste the contents of the cell with
    > that
    > name to the target cell, but it just won't accept the "name" of the cell
    > as a
    > range type variable. It will accept it as a string, but i can't seem to
    > get
    > it to accept a string variable in a line such as :-
    > range("variable_name").select
    >
    > HELP
    > I hope i've made this clear for you all,
    > is there a way around this?
    > Thanks in advance
    > John Foster




  3. #3
    john foster
    Guest

    Re: trouble selecting a named cell

    thanks norman, but method range of object failed @ this line :-
    Rng = Range("_17548")
    plus I want Rng to contain a cell value (cell a1 - which will be one of the
    other cell names - say _17548, or 17549 etc, depending on conditions)

    sorry

    "Norman Jones" wrote:

    > Hi John,
    >
    > Try:
    >
    > Dim Rng As Range
    >
    > Rng = Range( "_17548")
    >
    > Sheets("Sheet2").Range("A1").Value = Rng.Value
    >
    > Note that if you use a range variable, an expression like:
    >
    > > range("variable_name").

    >
    > will cause an error: the variable, e.g. Rng, refers to a range, so the use
    > of :
    >
    > > range

    >
    > is incorrect.
    >
    >
    > ---
    > Regards,
    > Norman
    >
    >
    > "john foster" <johnfoster@discussions.microsoft.com> wrote in message
    > news:58C17503-7738-450E-8258-FD242D8925DE@microsoft.com...
    > >I have a column of cells named/labelled in series thus: _17548, _17549
    > >and
    > > so on.
    > >
    > > I have a cell on another sheet whose value will be, depending on whatever
    > > conditions, one of these values.
    > >
    > > I need to paste the value of the correspondingly named cell on the first
    > > sheet to another cell on the second.
    > >
    > > I am having major difficulty doing this, I try to assign the value of the
    > > source cell as a variable and then paste the contents of the cell with
    > > that
    > > name to the target cell, but it just won't accept the "name" of the cell
    > > as a
    > > range type variable. It will accept it as a string, but i can't seem to
    > > get
    > > it to accept a string variable in a line such as :-
    > > range("variable_name").select
    > >
    > > HELP
    > > I hope i've made this clear for you all,
    > > is there a way around this?
    > > Thanks in advance
    > > John Foster

    >
    >
    >


  4. #4
    Norman Jones
    Guest

    Re: trouble selecting a named cell

    Hi John,

    How have you named the cell?


    ---
    Regards,
    Norman



    "john foster" <johnfoster@discussions.microsoft.com> wrote in message
    news:0EED2C6E-490C-4E05-91C2-F99C8E193243@microsoft.com...
    > thanks norman, but method range of object failed @ this line :-
    > Rng = Range("_17548")
    > plus I want Rng to contain a cell value (cell a1 - which will be one of
    > the
    > other cell names - say _17548, or 17549 etc, depending on conditions)
    >
    > sorry
    >
    > "Norman Jones" wrote:
    >
    >> Hi John,
    >>
    >> Try:
    >>
    >> Dim Rng As Range
    >>
    >> Rng = Range( "_17548")
    >>
    >> Sheets("Sheet2").Range("A1").Value = Rng.Value
    >>
    >> Note that if you use a range variable, an expression like:
    >>
    >> > range("variable_name").

    >>
    >> will cause an error: the variable, e.g. Rng, refers to a range, so the
    >> use
    >> of :
    >>
    >> > range

    >>
    >> is incorrect.
    >>
    >>
    >> ---
    >> Regards,
    >> Norman
    >>
    >>
    >> "john foster" <johnfoster@discussions.microsoft.com> wrote in message
    >> news:58C17503-7738-450E-8258-FD242D8925DE@microsoft.com...
    >> >I have a column of cells named/labelled in series thus: _17548,
    >> >_17549
    >> >and
    >> > so on.
    >> >
    >> > I have a cell on another sheet whose value will be, depending on
    >> > whatever
    >> > conditions, one of these values.
    >> >
    >> > I need to paste the value of the correspondingly named cell on the
    >> > first
    >> > sheet to another cell on the second.
    >> >
    >> > I am having major difficulty doing this, I try to assign the value of
    >> > the
    >> > source cell as a variable and then paste the contents of the cell with
    >> > that
    >> > name to the target cell, but it just won't accept the "name" of the
    >> > cell
    >> > as a
    >> > range type variable. It will accept it as a string, but i can't seem to
    >> > get
    >> > it to accept a string variable in a line such as :-
    >> > range("variable_name").select
    >> >
    >> > HELP
    >> > I hope i've made this clear for you all,
    >> > is there a way around this?
    >> > Thanks in advance
    >> > John Foster

    >>
    >>
    >>




+ 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