joe bredestege
joe bredestege

Reputation: 41

Excel VBA cell referencing

I'm growing extremely frustrated with the following code:

Range("H" & LastRow + 1).Select
NewRow = LastRow + 1
ActiveCell.FormulaR1C1 = "=C3R" & NewRow & "*C8R" & NewRow

I keep getting errors on the last line, but I cannot for the life of me figure out what I'm doing wrong.

All I need in the cell is: =C6*G6

Upvotes: 0

Views: 100

Answers (1)

Vincent De Smet
Vincent De Smet

Reputation: 4979

Write row first, column second - so to get the multiplication of C column and G column on same line as active cell, write: ActiveCell.FormulaR1C1="=RC3*RC7"

But couldn't you just write ActiveCell.Formula="=C" & NewRow & "*" & "G" & NewRow?

Upvotes: 1

Related Questions