Trying to Drag a Formula but it only Copies the First Cell

G

Guest

I used the following in my code:

Range("G2").Select
Range("G2").Formula = "=IF(C2+E2>0,1,IF(E2>0,1,""""))"
Dim lastrow As Long
lastrow = Cells(Rows.Count, "C").End(xlUp).Row
Range("G2").AutoFill Range("g2:g" & lastrow)


The formula is dragged down the column and the rows in the formula change
yet the value is simply that of G2 all the way down. Only when I select the
cell and press enter will it read accurately. It seems this is more an excel
issue than a VBA one since I get the same results when entering any simple
formula manually.

Thanks
 
G

Gary Keramidas

works for me, sure calculation is set to auto

add this as the last line and see if it helps.

Application.Calculation = xlCalculationAutomatic
 
G

Guest

Perfect. Thanks so much.

Gary Keramidas said:
works for me, sure calculation is set to auto

add this as the last line and see if it helps.

Application.Calculation = xlCalculationAutomatic
 

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