ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy Cell Above (https://www.excelbanter.com/excel-programming/314239-copy-cell-above.html)

Materialised[Work]

Copy Cell Above
 
Hi All,

I am wondering if anyone would be kind enough to provide me with a
code sample (and maybe a explanation) of how to copy the cell above
the active cell and paste it into the active cell from a macro.

I have tried a few things, but have come no where close, and this
macro, simple as it is, would greatly improve my output as I am
generating pivot tables from data imported from Microsoft Navision.

Thanks
Mick

Nicke[_17_]

Copy Cell Above
 

ActiveCell.Offset(-1).Copy
ActiveCell.PasteSpecial xlPasteAll
Application.CutCopyMode = Fals

--
Nick
-----------------------------------------------------------------------
Nicke's Profile: http://www.excelforum.com/member.php...nfo&userid=293
View this thread: http://www.excelforum.com/showthread.php?threadid=27110


newbie

Copy Cell Above
 
ActiveCell.Value = ActiveCell.Offset(-1).Value

"Materialised[Work]" wrote:

Hi All,

I am wondering if anyone would be kind enough to provide me with a
code sample (and maybe a explanation) of how to copy the cell above
the active cell and paste it into the active cell from a macro.

I have tried a few things, but have come no where close, and this
macro, simple as it is, would greatly improve my output as I am
generating pivot tables from data imported from Microsoft Navision.

Thanks
Mick


Michael Hachen

Copy Cell Above
 
Hi Mick

Here's a sample:
Sub CopyFromAbove()
On Error GoTo Error
ActiveCell.Value = Cells(ActiveCell.Row - 1, ActiveCell.Column).Value
Error:
Exit Sub
End Sub

CU
Mike

"Materialised[Work]" schrieb im Newsbeitrag
om...
Hi All,

I am wondering if anyone would be kind enough to provide me with a
code sample (and maybe a explanation) of how to copy the cell above
the active cell and paste it into the active cell from a macro.

I have tried a few things, but have come no where close, and this
macro, simple as it is, would greatly improve my output as I am
generating pivot tables from data imported from Microsoft Navision.

Thanks
Mick





All times are GMT +1. The time now is 01:24 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com