copy down values in adjacent coumn

S

SoozeeC

I have data in column B, the number of active cells in which is variable. I
want to perform a calculation in C2 relating to B2 and then copy it down
column C as far as the last active cell in column B.

Any ideas?
 
P

Patrick Molloy

range( range("C3) , Range("B2").End(xldown).offset(,1) ).FormulaR1C1 = _
Range("C2").FormulaR1C1
 
J

Jacob Skaria

Try the below..

Sub Macro()

Dim lngRow As Long
'Returns the last filled row in colB
lngRow = Cells(Rows.Count, "B").End(xlUp).Row

Range("C2:C" & lngRow).Formula = "=sum(a2:b2)"

End Sub

If this post helps click Yes
 
J

Joel

Usually I put the formula in C2 and then copy down the column

Range("C2").formula = "=B2+1"
LastRow = Range("B" & Rows.count).end(xlup).row
Range("C2").copy _
Destination:=Range("C2:C" & LastRow)
 
P

Patrick Molloy

I also assumed that the formula was in C3.

Joel said:
Usually I put the formula in C2 and then copy down the column

Range("C2").formula = "=B2+1"
LastRow = Range("B" & Rows.count).end(xlup).row
Range("C2").copy _
Destination:=Range("C2:C" & LastRow)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top