ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   cell reference in formula (https://www.excelbanter.com/excel-programming/290399-re-cell-reference-formula.html)

Nigel[_8_]

cell reference in formula
 
Try this .......

Sub copyover()
Dim a As Long, i As Long

For a = 2 To 18
i = (a - 1) * 2
Worksheets("Sheet1").Range("B" & a).Value =
Worksheets("Sheet2").Range("B" & i).Value
Next a

End Sub

Cheers
Nigel

"gogo" wrote in message
...
hi
here is what's troubles me. the code below doesn't work but it helps you

understand. i want that cell in (sheet2,B2) have a value of cell in
(sheet1,B2), cell in (sheet2,B3) have a value of cell in (sheet1,B4) ... and
so. the pattern is: columns are same but rows in sheet2 are continues, and
in sheet2 goes by even numbers - 2,4,6,8...
For a = 2 To 18 // a

=number of row in sheet2
i = (a - 1) * 2 // i

=even number sequence[i]
Range("B" & a).Select
ActiveCell.FormulaR1C1 = "=sheet1!RC" // here is question:

how to reference a variable index "i"
Next a

tnx in advance





----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! 100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---

gogo

cell reference in formula
 
tnx Nigel. that give the result but it was not excatly what i wanted
again tnx anyway


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

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