ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   paste code (https://www.excelbanter.com/excel-programming/317454-paste-code.html)

scrabtree23[_3_]

paste code
 
This code has worked good for me in the past:

Dim rng As Range
Set rng = ActiveSheet.AutoFilter.Range
rng.Copy Destination:=Worksheets("Stepdown").Range("A1")

However, it doesn't copy the formulas in the range to the destination as
formulas but converst them to text. How can I modify my code so that it
copies all the formulas, too?

Debra Dalgleish

paste code
 
You could paste the formulas in a separate step:

Dim ws As Worksheet
Set ws = Worksheets("Stepdown")
Dim rng As Range
Set rng = ActiveSheet.AutoFilter.Range
rng.Copy Destination:=ws.Range("A1")
rng.Copy
ws.Activate
ws.Range("A1").PasteSpecial Paste:=xlPasteFormulas


scrabtree23 wrote:
This code has worked good for me in the past:

Dim rng As Range
Set rng = ActiveSheet.AutoFilter.Range
rng.Copy Destination:=Worksheets("Stepdown").Range("A1")

However, it doesn't copy the formulas in the range to the destination as
formulas but converst them to text. How can I modify my code so that it
copies all the formulas, too?



--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html



All times are GMT +1. The time now is 12:02 AM.

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