dimanche 25 janvier 2015

VBA Copy Cells + Formatting without using the clipboard


Vote count:

0




I'm trying to copy cells from one sheet to another without copying stuff to the clipboard but it must copy the formatting across.


Here are the ways I've tried at the moment, any ideas how to accomplish my needs?



LastRow = ThisWorkbook.Sheets("Nas").Range("A65536").End(xlUp).Row

'Option 1, works but it's using the clipboard :/
ThisWorkbook.Sheets("Nas").Range("A" & 6 & ":F" & LastRow).Copy
ThisWorkbook.Sheets("Test").Range("A" & 6 & ":F" & LastRow).Offset(-5, 0).PasteSpecial

'Option 2, works but doesn't take formatting (ie text, general, time, date... etc)
Set Src = ThisWorkbook.Sheets("Nas").Range("A" & 6 & ":F" & LastRow)
Set Dst = ThisWorkbook.Sheets("Test").Range("A" & 6 & ":F" & LastRow).Offset(-5, 0).Resize(Src.Rows.Count, Src.Columns.Count)
Dst.Value = Src.Value

'Option 3, works but doesn't take formatting (ie text, general, time, date... etc)
ThisWorkbook.Sheets("Test").Range("A" & 6 & ":F" & LastRow).Offset(-5, 0) = ThisWorkbook.Sheets("Nas").Range("A" & 6 & ":F" & LastRow).Values


asked 50 secs ago







VBA Copy Cells + Formatting without using the clipboard

Aucun commentaire:

Enregistrer un commentaire