vba code

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

why does this code not input a formula into cells
e5 to end of data

Range("D6").Select
Selection.End(xlDown).Select
ActiveCell.Offset(0, 1).Range("A1").Select
Do Until Range("E5").Select
ActiveCell.FormulaR1C1 = "=R2C8/(RC[-2]-RC[-4])"
ActiveCell.Offset(-1, 0).Range("a1").Select
Loop
 
Hi agw,

Try the following change:


Do Until ActiveCell.Address = "$E$5"

Ken Johnson
 
It looks like you're using column D to get the last used cell.

If that's true:

with activesheet
.range("E5:E" & .cells(.rows.count,"D").end(xlup).row).formular1c1 _
= "=R2C8/(RC[-2]-RC[-4])"
end with

why does this code not input a formula into cells
e5 to end of data

Range("D6").Select
Selection.End(xlDown).Select
ActiveCell.Offset(0, 1).Range("A1").Select
Do Until Range("E5").Select
ActiveCell.FormulaR1C1 = "=R2C8/(RC[-2]-RC[-4])"
ActiveCell.Offset(-1, 0).Range("a1").Select
Loop
 
Back
Top