View Full Version : [SOLVED:] VBA Cell Formatting Copy
ronjon65
02-23-2015, 03:00 PM
I just want to copy cells from one sheet to another (preferably a range of them).
When I used Sheet1.Cells(1,1) = Sheet2.Cells(1,1) the formatting does not go with it. I need to keep the formatting (subscripts and superscripts) along with the cell copy (or range copy). It seems simple, but I am not sure how to do this efficiently.
Thanks.
mancubus
02-23-2015, 03:33 PM
Worksheets("Sheet1").Range("A1").Copy Destination:=Worksheets("Sheet2").Range("A1")
or
Worksheets("Sheet1").Range("A1").Copy Worksheets("Sheet2").Range("A1")
or
Worksheets("Sheet1").Range("A1").Copy
Worksheets("Sheet2").Range("A1").PasteSpecial
or
Worksheets("Sheet1").Range("A1").Copy
Worksheets("Sheet2").Range("A1").PasteSpecial xlPasteAll
or
Worksheets("Sheet1").Range("A1").Copy
Worksheets("Sheet2").Range("A1").PasteSpecial xlPasteFormulasAndNumberFormats
or
Worksheets("Sheet1").Range("A1").Copy
Worksheets("Sheet2").Range("A1").PasteSpecial xlPasteValuesAndNumberFormats
ronjon65
02-24-2015, 02:42 PM
Thanks! Works just fine :)
mancubus
02-25-2015, 12:14 AM
you are welcome.
please mark the thread as solved from "Thread Tools" dropdown which is above the first message.
1st and 2nd codes are the same.
copy method has one (optional) argument: Destination.
3rd and 4th codes are the same.
xlPasteAll is the default for Paste argument of PasteSpecial method.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.