Copying Formula

  • Thread starter Thread starter Michael
  • Start date Start date
M

Michael

Hi all,

Is it possible to copy a formula using a macro from a
selected cell in a range to the cell directly above it?
without having to actually code the cell reference each
time?

The range I refer to can have rows deleted and inserted by
the user, thus the cell references will constantly change.

Thanks for your help


Michael
 
Sub test()

ActiveCell.Copy
ActiveCell.Offset(-1, 0).PasteSpecial
Paste:=xlPasteFormulas
End Sub

Abdul Salam
 
Hi Michael,

If the formula components are all relative you can make a straight copy as
follows.

Sub CopyUp1Cell()
ActiveCell.Copy ActiveCell.Offset(-1, 0)
End Sub

The above works on the activecell, but you can refer to it as you wish.

e.g. Range("H20"), cells(20, 8)

regards,
Don
 
Back
Top