ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   activecell.formular1c1 (https://www.excelbanter.com/excel-programming/296695-activecell-formular1c1.html)

monika

activecell.formular1c1
 
hi...

i have to get something like this ='Sum Jun''04'!C30+'Sum
Jul''04'!C30+'Sum Aug''04'!C30+'Sum Sep''04'!C30

in a cell..which i will do a copy paste thing in some 5
rows and 12 columns. fi i record hte macro i get :
ActiveCell.FormulaR1C1 = _
"='Sum Jun''04'!R[25]C+'Sum Jul''04'!R[25]C+'Sum
Aug''04'!R[25]C+'Sum Sep''04'!R[25]C"
Range("C5").Select
Selection.Copy
Range("C5:C11").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.Copy
Range("C5:O11").Select
ActiveSheet.Paste
I have converted the above with the below code.It runs
perfectly fine if replace the "R[25]C" in the
activecell.formular1c1; i want it to be replaced by cells
(row,column).address(0,0) so that i can do copy paste. I
dont want to hardcode R[25]C...can anyone suggest me hte
way.,

I hope i am clear
thanks a lot

varComb = ""
For ig = 1 To totSumSheets 'repeat as
many sheets are there
st = 1
ext22 = ""
For kl = 1 To Len(trapSumShtName(ig))
ext11 = Mid(trapSumShtName(ig), st, 1)
ext22 = ext22 & ext11
If ext11 = "'" Then ext22 = ext22 & "'"
st = st + 1
Next kl
varComb = varComb & "'" & ext22 & "'!" & "R" & uuRow +
1 & "C" & 3
If Not ig = totSumSheets Then varComb = varComb & "+"
Next ig

Range(Cells(5, 3).Address(0, 0)).Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=" & varComb
Range(Cells(5, 3).Address(0, 0)).Select
Selection.Copy
Range(Cells(5, 3).Address(0, 0) & ":" & Cells(5 + nm2,
3).Address(0, 0)).Select
ActiveSheet.Paste
Range(Cells(5, 3).Address(0, 0) & ":" & Cells(5 + nm2,
3).Address(0, 0)).Select
Application.CutCopyMode = False
Selection.Copy
Range(Cells(5, 3).Address(0, 0) & ":" & Cells(5 + nm2, 3 +
nm).Address(0, 0)).Select
ActiveSheet.Paste


All times are GMT +1. The time now is 11:00 PM.

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