ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Why does this code not work for me? (https://www.excelbanter.com/excel-programming/404842-why-does-code-not-work-me.html)

Patrick C. Simonds

Why does this code not work for me?
 
First, sorry about the double post, but realized I posted my question to the
wrong forum.


Can anyone tell me why this code not only pastes the Formulas (which I want)
but also the values in the cells?


Sub test()

Dim cellActive As Range
Set cellActive = ActiveCell


Dim rgNewRow As Range
ActiveCell.EntireRow.Insert Shift:=xlDown
Set rgNewRow = Rows(cellActive.Row - 1)


cellActive.EntireRow.Copy

rgNewRow.PasteSpecial (xlPasteFormulas)


End Sub


Nigel[_2_]

Why does this code not work for me?
 
It is correct, the option Formulas takes the 'formula and values' only, in
other words formatting etc, is ignored.

--

Regards,
Nigel




"Patrick C. Simonds" wrote in message
...
First, sorry about the double post, but realized I posted my question to
the wrong forum.


Can anyone tell me why this code not only pastes the Formulas (which I
want)
but also the values in the cells?


Sub test()

Dim cellActive As Range
Set cellActive = ActiveCell


Dim rgNewRow As Range
ActiveCell.EntireRow.Insert Shift:=xlDown
Set rgNewRow = Rows(cellActive.Row - 1)


cellActive.EntireRow.Copy

rgNewRow.PasteSpecial (xlPasteFormulas)


End Sub




All times are GMT +1. The time now is 02:48 PM.

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