ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Adding a Value from one worksheet to another. (https://www.excelbanter.com/excel-programming/380295-adding-value-one-worksheet-another.html)

newguy

Adding a Value from one worksheet to another.
 
I have tried making sense of the code from the Macro when I recorded it
but it isnt working for me.

Range("Q6").Select
ActiveCell.FormulaR1C1 = "=RC[-14]+'07-Dec-06'!RC"
Range("Q7").Select

This works but I need to apply it to multiple worksheets so I need it
to be more dynamic in the sense that it doesnt reference '07-Dec-06'
but something along the lines of

Range("Q6").Select
ActiveCell.FormulaR1C1 = "=RC[-14]+'Sheets(ActiveSheet.Index -
1)'!RC"
Range("Q7").Select

Or some way of selecting the previous worksheet then the one I am on
and doing a calculation in a cell.


Bob Phillips

Adding a Value from one worksheet to another.
 
Maybe this

Range("Q6").FormulaR1C1 = "=RC[-14]+'Sheets(" & _
Worksheets(ActiveSheet.Index - 1).Name & ")'!RC"
Range("Q7").Select


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"newguy" wrote in message
oups.com...
I have tried making sense of the code from the Macro when I recorded it
but it isnt working for me.

Range("Q6").Select
ActiveCell.FormulaR1C1 = "=RC[-14]+'07-Dec-06'!RC"
Range("Q7").Select

This works but I need to apply it to multiple worksheets so I need it
to be more dynamic in the sense that it doesnt reference '07-Dec-06'
but something along the lines of

Range("Q6").Select
ActiveCell.FormulaR1C1 = "=RC[-14]+'Sheets(ActiveSheet.Index -
1)'!RC"
Range("Q7").Select

Or some way of selecting the previous worksheet then the one I am on
and doing a calculation in a cell.




newguy

Adding a Value from one worksheet to another.
 
That gets the formula in the cell now everytime I run it, it asks me to
save the file.


Bob Phillips wrote:
Maybe this

Range("Q6").FormulaR1C1 = "=RC[-14]+'Sheets(" & _
Worksheets(ActiveSheet.Index - 1).Name & ")'!RC"
Range("Q7").Select


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"newguy" wrote in message
oups.com...
I have tried making sense of the code from the Macro when I recorded it
but it isnt working for me.

Range("Q6").Select
ActiveCell.FormulaR1C1 = "=RC[-14]+'07-Dec-06'!RC"
Range("Q7").Select

This works but I need to apply it to multiple worksheets so I need it
to be more dynamic in the sense that it doesnt reference '07-Dec-06'
but something along the lines of

Range("Q6").Select
ActiveCell.FormulaR1C1 = "=RC[-14]+'Sheets(ActiveSheet.Index -
1)'!RC"
Range("Q7").Select

Or some way of selecting the previous worksheet then the one I am on
and doing a calculation in a cell.



Dave Peterson

Adding a Value from one worksheet to another.
 
How about this:

Range("Q6").FormulaR1C1 _
= "=RC[-14]+'" & Worksheets(ActiveSheet.Index - 1).Name & "'!RC"



newguy wrote:

That gets the formula in the cell now everytime I run it, it asks me to
save the file.

Bob Phillips wrote:
Maybe this

Range("Q6").FormulaR1C1 = "=RC[-14]+'Sheets(" & _
Worksheets(ActiveSheet.Index - 1).Name & ")'!RC"
Range("Q7").Select


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"newguy" wrote in message
oups.com...
I have tried making sense of the code from the Macro when I recorded it
but it isnt working for me.

Range("Q6").Select
ActiveCell.FormulaR1C1 = "=RC[-14]+'07-Dec-06'!RC"
Range("Q7").Select

This works but I need to apply it to multiple worksheets so I need it
to be more dynamic in the sense that it doesnt reference '07-Dec-06'
but something along the lines of

Range("Q6").Select
ActiveCell.FormulaR1C1 = "=RC[-14]+'Sheets(ActiveSheet.Index -
1)'!RC"
Range("Q7").Select

Or some way of selecting the previous worksheet then the one I am on
and doing a calculation in a cell.


--

Dave Peterson

newguy

Adding a Value from one worksheet to another.
 
That worked that you

Dave Peterson wrote:
How about this:

Range("Q6").FormulaR1C1 _
= "=RC[-14]+'" & Worksheets(ActiveSheet.Index - 1).Name & "'!RC"



newguy wrote:

That gets the formula in the cell now everytime I run it, it asks me to
save the file.

Bob Phillips wrote:
Maybe this

Range("Q6").FormulaR1C1 = "=RC[-14]+'Sheets(" & _
Worksheets(ActiveSheet.Index - 1).Name & ")'!RC"
Range("Q7").Select


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"newguy" wrote in message
oups.com...
I have tried making sense of the code from the Macro when I recorded it
but it isnt working for me.

Range("Q6").Select
ActiveCell.FormulaR1C1 = "=RC[-14]+'07-Dec-06'!RC"
Range("Q7").Select

This works but I need to apply it to multiple worksheets so I need it
to be more dynamic in the sense that it doesnt reference '07-Dec-06'
but something along the lines of

Range("Q6").Select
ActiveCell.FormulaR1C1 = "=RC[-14]+'Sheets(ActiveSheet.Index -
1)'!RC"
Range("Q7").Select

Or some way of selecting the previous worksheet then the one I am on
and doing a calculation in a cell.


--

Dave Peterson




All times are GMT +1. The time now is 02:54 AM.

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