Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default 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

"GeorgeF" wrote in message
...
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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default 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

"GeorgeF" wrote in message
...
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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Get cell reference address Vadims Podans [MVP] Excel Worksheet Functions 2 April 10th 09 08:50 PM
Cell address without absolute reference jayray Excel Worksheet Functions 1 April 24th 08 12:42 PM
worksheet reference returns address instead of value pobruce Excel Worksheet Functions 2 January 20th 06 09:55 PM
How do I get the cell address of a VLOOKUP reference? tfleischny Excel Worksheet Functions 4 January 4th 06 11:16 PM
How to reference a cell address in VBA Ivan Excel Programming 1 March 1st 04 03:11 PM


All times are GMT +1. The time now is 10:37 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"