I am trying to copy data and conditional formatting from one workbook to another. I can get the data to transfer over to my primary workbook, but the conditional formatting is being removed. How do I copy the data and conditional formatting from one workbook to another?
This is what I have so far:
Dim Master As Workbook
Set Master = ActiveWorkbook
Dim lastRow As Long
lastRow = ActiveSheet.Cells(Rows.Count, 2).End(xlUp).Row
Range("A2:AE2" & lastRow).Select Selection.Copy
Master.Activate
ThisWorkbook.ActiveSheet.Cells(lastRow, 1).Paste
I have tried Paste Special and it does not work either.
.Paste
you use.PasteSpecial
, see stackoverflow.com/questions/41725730/… – wbrugatoWorkbooks("book1").Worksheets("sheet1").Range("a1").Copy Destination:=Workbooks("book2").Worksheets("sheet1").Range("a1")
. The conditional formatting was copied over OK, so I would work from this and slowly change it to what you want and see when it stops working. Also what version of excel? – garbbRange("A2:AE2" & lastRow).Select Selection.Copy
? I don't think that the select method has any parameters? – garbb