ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   New Users to Excel (https://www.excelbanter.com/new-users-excel/)
-   -   Referencing Sheet Names (https://www.excelbanter.com/new-users-excel/48532-referencing-sheet-names.html)

Stuart Grant

Referencing Sheet Names
 
It seems so elementary I'm almost ashamed to ask.
I want to copy the ActiveCell.Value to a cell on another sheet in the same
workbook. The sheet is called Q1Trans. I put in the macro
ActiveCell.Copy Destination:=Q1Trans!Range("C101")
At Q1Trans in the macro I get the error message "Variable not defined". I
have tried putting it in parentheses with and without single or double
quotes but again get an error message.
If I substitute Sheet6 for Q1Trans, the macro works.
Why won't it accept the Sheet name as shown on the Tab ?
Stuart



JE McGimpsey

Try:

ActiveCell.Copy Destination:=Worksheets("Q1Trans").Range("C101")

or, somewhat less efficiently (IIRC):

Activecell.Copy Destination:=Range("Q1Trans!C101")



In article ,
"Stuart Grant" <sagrantatbluewindotch wrote:

It seems so elementary I'm almost ashamed to ask.
I want to copy the ActiveCell.Value to a cell on another sheet in the same
workbook. The sheet is called Q1Trans. I put in the macro
ActiveCell.Copy Destination:=Q1Trans!Range("C101")
At Q1Trans in the macro I get the error message "Variable not defined". I
have tried putting it in parentheses with and without single or double
quotes but again get an error message.
If I substitute Sheet6 for Q1Trans, the macro works.
Why won't it accept the Sheet name as shown on the Tab ?



All times are GMT +1. The time now is 07:09 PM.

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