Copy and Pasting Data

ERed1

Board Regular
Joined
Jun 26, 2019
Messages
104
Hey everyone,

I am trying to Copy data from one sheet and paste it into another. I want the rows that are hidden to stay hidden when they are being pasted instead of reappearing. I am guessing it is a Paste option, but I don't know which one. Thank you in advance.

Here is my code I am using:

If Range("B16").Value = "Pizza" Then
Sheets("Part Number Creation").Range("A16:D19").Copy
Sheets("Finished").Activate
lastrow = Range("A65536").End(xlUp).Row
Cells(lastrow + 5, 1).PasteSpecial Operation:=xlNone, SkipBlanks:=False, Transpose:=False

Sheets("Part Number Creation").Range("A21:D30").Copy
Sheets("Finished").Activate
lastrow = Range("A65536").End(xlUp).Row
Cells(lastrow + 1, 1).PasteSpecial Operation:=xlNone, SkipBlanks:=False, Transpose:=False
End If
 
Last edited:

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Try replacing the 2nd line with:

Code:
Sheets("Part Number Creation").Range("A16:D19").SpecialCells(xlCellTypeVisible).Copy

Do similar for the 6th line.
 
Upvote 0
It worked for all but one. I am going to see if I can fiddle with the one thats not working and keep you updated. Thanks a lot for the code!
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,252
Members
452,623
Latest member
Techenthusiast

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