![]() |
Copying Formula
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 |
Copying Formula
Sub test()
ActiveCell.Copy ActiveCell.Offset(-1, 0).PasteSpecial Paste:=xlPasteFormulas End Sub Abdul Salam -----Original Message----- 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 . |
Copying Formula
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 -- "Michael" wrote in message ... 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 |
Copying Formula
Thanks Guys.
-----Original Message----- 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 . |
All times are GMT +1. The time now is 06:57 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com