Forum Discussion
problem copying and pasting
- Feb 19, 2023
OK, I see what's happening.
The cells in columns A and B on the Members1 sheet have font colors applied manually, but those are overruled by the conditional formatting rules.
For example, the text ANGELLE GARY in A4 and B4 is formatted manually as red, but since M4 contains Senior, the conditional formatting rule overrules that and colors the text blue.
When the code copies columns A and B to columns B and C on the Score Input-Flights sheet, both the manual formatting and the conditional formatting are copied.
But none of he conditional formatting rules is applied, since the rules now refer to column M on the Score Input-Flights sheet, and that column is empty.
So the cells display the manually applied colors. On the second sheet, ANGELLE GARY is red, not blue.
To keep the conditional formatting rules working, you have to copy column M too:
Sub Test() Application.ScreenUpdating = False Sheets("Members1").Range("A1:B200").Copy With Sheets("Score Input-Flights").Range("B1:C200") .PasteSpecial Paste:=xlFormats .PasteSpecial Paste:=xlValues End With Sheets("Members1").Range("M1:M200").Copy With Sheets("Score Input-Flights").Range("M1:M200") .PasteSpecial Paste:=xlFormats .PasteSpecial Paste:=xlValues End With Application.CutCopyMode = False Application.ScreenUpdating = True End Sub
No, I don't see an attachment, nor a link, nor a private message from you.
- bcselectFeb 19, 2023Copper ContributorI just sent it again. Did you get it?
- HansVogelaarFeb 19, 2023MVP
If I copy names from the first sheet to the second sheet manually, the colors are preserved.
You didn't include the macro in the workbook.
Could you post the code?
- bcselectFeb 19, 2023Copper ContributorPay particular attention to rows 110 and 117. compare the colors before and after on both sheets.
- HansVogelaarFeb 19, 2023MVP
Yes, I did, thanks. I will take a look.