Pasting Values, not formulas as I want

jim may

Well-known Member
Joined
Jul 4, 2004
Messages
7,486
In my Rng1 - Col A and Col F - I have formulas;
My Rng1.copy line is pasting these as Values into my destination sheet, not a formulas. What's Up? Can someone spot the problem?
Thanks,


Code:
Set rng = ActiveSheet.AutoFilter.Range
    rng.AutoFilter Field:=12, Criteria1:="<>"
    Set Rng1 = rng.Offset(1).SpecialCells(xlCellTypeVisible)
    Nr = Worksheets("Data-CompletedItems").Range("B" & Rows.Count).End(xlUp).Row + 1
    'Set destrng = Sheets("Data-CompletedItems").Range("A" & Nr)
    Rng1.Copy Destination:=Sheets("Data-CompletedItems").Range("A" & Nr)
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Jim,

I am learning this myself but maybe this line (nothing to do with your macro) may push you in the right direction

Range("A").PasteSpecial (xlPasteFormulas)
 
Upvote 0
Got R/T 1004 error with:

Rng1.Copy Destination:=Sheets("Data-CompletedItems").Range("A" & Nr).PasteSpecial(xlPasteFormulas)
 
Upvote 0
I'm getting a R/Y 438 using:

Rng1.Copy Worksheets("Data-CompletedItems").Range("A" & Nr).Paste
 
Upvote 0
From the immediate window
Maybe you can't paste broken up range references such as these.. Pastespecail.value
if the only option... ???


? rng1.Address
$A$7:$AJ$7,$A$12:$AJ$12,$A$17:$AJ$17,$A$254:$AJ$254
 
Upvote 0
maybe try

Rng1.Copy
Sheets("Data-CompletedItems").Range("A" & Nr).PasteSpecial(xlPasteFormulas)
 
Upvote 0
When working with discontinous ranges, one should use the .Areas property.
Code:
'Dim rng As Range, Rng1 As Range, Nr As Long
Dim oneArea As Range

    Set rng = ActiveSheet.AutoFilter.Range
    rng.AutoFilter Field:=12, Criteria1:="<>"
    Set Rng1 = rng.Offset(1).SpecialCells(xlCellTypeVisible)

For Each oneArea in Rng1.Areas
    Nr = Worksheets("Data-CompletedItems").Range("B" & Rows.Count).End(xlUp).Row

    oneArea.Copy Destination:=Sheets("Data-CompletedItems").Range("A" & Nr)
Next oneArea
I copied the code for the destination from the post above, you might want to add 1 to Nr before pasting over that last row.
 
Upvote 0

Forum statistics

Threads
1,224,566
Messages
6,179,553
Members
452,928
Latest member
101blockchains

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top