+ Reply to Thread
Results 1 to 4 of 4

How do I Address A Worksheet From A Cell Reference?

  1. #1
    GeorgeF
    Guest

    How do I Address A Worksheet From A Cell Reference?

    The following was generated by the macro recorder:

    Sheets("project01").Select
    Range("HL5:HZ8").Select
    Selection.Copy
    Sheets("Report").Select
    Range("DR502:EF505").Select
    ActiveSheet.Paste

    I need to be able to select the sheet that I am copying things from based on
    a cell value. For example, cell A1 could have "project06" or "project22" at
    any given time when this macro runs. How do I accomplish this "indirect"
    addressing? i.e., can I somehow use something like "Sheets("cell
    A1").Select"? (I am not a VB programmer.)

    Thank you.
    George

  2. #2
    Don Guillett
    Guest

    Re: How do I Address A Worksheet From A Cell Reference?

    You could use this but it is very seldom necessary to select
    Sheets(Range("f4").Value).Select

    Sheets(Range("f4").Value). Range("HL5:HZ8").Copy _
    Sheets("Report").range("DR502:EF505")

    or if only values to copy (range must be the same size)

    Sheets("Report").range("DR502:EF505").value= _
    Sheets(Range("f4").Value). Range("HL5:HZ8").value
    --
    Don Guillett
    SalesAid Software
    [email protected]
    "GeorgeF" <[email protected]> wrote in message
    news:[email protected]...
    > The following was generated by the macro recorder:
    >
    > Sheets("project01").Select
    > Range("HL5:HZ8").Select
    > Selection.Copy
    > Sheets("Report").Select
    > Range("DR502:EF505").Select
    > ActiveSheet.Paste
    >
    > I need to be able to select the sheet that I am copying things from based

    on
    > a cell value. For example, cell A1 could have "project06" or "project22"

    at
    > any given time when this macro runs. How do I accomplish this "indirect"
    > addressing? i.e., can I somehow use something like "Sheets("cell
    > A1").Select"? (I am not a VB programmer.)
    >
    > Thank you.
    > George




  3. #3
    GeorgeF
    Guest

    Re: How do I Address A Worksheet From A Cell Reference?

    Don - Works perfectly - thank you very much
    George

    "Don Guillett" wrote:

    > You could use this but it is very seldom necessary to select
    > Sheets(Range("f4").Value).Select
    >
    > Sheets(Range("f4").Value). Range("HL5:HZ8").Copy _
    > Sheets("Report").range("DR502:EF505")
    >
    > or if only values to copy (range must be the same size)
    >
    > Sheets("Report").range("DR502:EF505").value= _
    > Sheets(Range("f4").Value). Range("HL5:HZ8").value
    > --
    > Don Guillett
    > SalesAid Software
    > [email protected]
    > "GeorgeF" <[email protected]> wrote in message
    > news:[email protected]...
    > > The following was generated by the macro recorder:
    > >
    > > Sheets("project01").Select
    > > Range("HL5:HZ8").Select
    > > Selection.Copy
    > > Sheets("Report").Select
    > > Range("DR502:EF505").Select
    > > ActiveSheet.Paste
    > >
    > > I need to be able to select the sheet that I am copying things from based

    > on
    > > a cell value. For example, cell A1 could have "project06" or "project22"

    > at
    > > any given time when this macro runs. How do I accomplish this "indirect"
    > > addressing? i.e., can I somehow use something like "Sheets("cell
    > > A1").Select"? (I am not a VB programmer.)
    > >
    > > Thank you.
    > > George

    >
    >
    >


  4. #4
    Don Guillett
    Guest

    Re: How do I Address A Worksheet From A Cell Reference?

    glad to help

    --
    Don Guillett
    SalesAid Software
    [email protected]
    "GeorgeF" <[email protected]> wrote in message
    news:[email protected]...
    > Don - Works perfectly - thank you very much
    > George
    >
    > "Don Guillett" wrote:
    >
    > > You could use this but it is very seldom necessary to select
    > > Sheets(Range("f4").Value).Select
    > >
    > > Sheets(Range("f4").Value). Range("HL5:HZ8").Copy _
    > > Sheets("Report").range("DR502:EF505")
    > >
    > > or if only values to copy (range must be the same size)
    > >
    > > Sheets("Report").range("DR502:EF505").value= _
    > > Sheets(Range("f4").Value). Range("HL5:HZ8").value
    > > --
    > > Don Guillett
    > > SalesAid Software
    > > [email protected]
    > > "GeorgeF" <[email protected]> wrote in message
    > > news:[email protected]...
    > > > The following was generated by the macro recorder:
    > > >
    > > > Sheets("project01").Select
    > > > Range("HL5:HZ8").Select
    > > > Selection.Copy
    > > > Sheets("Report").Select
    > > > Range("DR502:EF505").Select
    > > > ActiveSheet.Paste
    > > >
    > > > I need to be able to select the sheet that I am copying things from

    based
    > > on
    > > > a cell value. For example, cell A1 could have "project06" or

    "project22"
    > > at
    > > > any given time when this macro runs. How do I accomplish this

    "indirect"
    > > > addressing? i.e., can I somehow use something like "Sheets("cell
    > > > A1").Select"? (I am not a VB programmer.)
    > > >
    > > > Thank you.
    > > > George

    > >
    > >
    > >




+ 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