Paste Special when moving data between worksheets

VBAN0oB

New Member
Joined
Oct 19, 2022
Messages
10
Office Version
  1. 365
Platform
  1. Windows
I am trying to figure out where to insert the paste special rule on my code. Currently each sheet has conditional formatting that isn't the same so the current code is overriding the conditional formatting on the new sheet it is pasted to.

'Apply loop for column A until last cell with value
For Each Cell In .Range("A1:A50" & .Cells(.Rows.Count, "D").End(xlUp).Row)
Selection.EntireRow.Select
'Apply condition to match the "Pipeline" value
If Cell.Value = "P" Then
Selection.EntireRow.Select
sheetNo2.Activate
tbl2.ListRows.Add
R = tbl2.Range.Rows.Count
sheetNo1.Activate
'Command to Copy and move to a destination Sheet "Pipeline"
.Rows(Cell.Row).Copy Destination:=sheetNo2.Rows(FinalRow2 + 1)
Selection.EntireRow.Select
.Rows(Cell.Row).Delete
FinalRow2 = FinalRow2 + 1
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Change this line:
VBA Code:
.Rows(Cell.Row).Copy Destination:=sheetNo2.Rows(FinalRow2 + 1)
to:
Code:
.Rows(Cell.Row).Copy
sheetNo2.Rows(FinalRow2 + 1).PasteSpecial Paste:=xlPasteValues
 
Upvote 0
Change this line:
VBA Code:
.Rows(Cell.Row).Copy Destination:=sheetNo2.Rows(FinalRow2 + 1)
to:
Code:
.Rows(Cell.Row).Copy
sheetNo2.Rows(FinalRow2 + 1).PasteSpecial Paste:=xlPasteValues
Thank you so very much for the assist. You just saved me a ton of time in further research and in going behind people and deleting the conditional formatting that follows.
 
Upvote 0
Thanks for the positive feedback(y), glad having been of some help.
 
Upvote 0

Forum statistics

Threads
1,224,812
Messages
6,181,104
Members
453,021
Latest member
Justyna P

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