问题
I am writing a method that can take the Target
and paste the cell exactly to another cell. The cell is a shipping label with some fancy formating. Is there a way I can do it?
Originally I have this:
Worksheets("Label").Range("A1").Value = Worksheets("Get Address").Range("A28").Value
It worked for the plain text. However I lost the styling I created, they are different because after the first line, the style is different:
I also tried to use Macro Recorder and I got a solution using .Select
, and I read this question not to use it whenever possible. What can I do?
' Created by the Macro Recorder
Range("A28:A33").Select
Range("A33").Activate
Selection.Copy
Sheets("Label").Select
Range("A1").Select
ActiveSheet.Paste
回答1:
Worksheets("Get Address").Range("A33").Copy _
Destination := Worksheets("Label").Range("A1")
回答2:
to copy and paste values only then use following
Worksheets("Label").Range("A1").value = _
Worksheets("Get Address").Range("A33").value
this statement will not use clip board
来源:https://stackoverflow.com/questions/16698644/vba-how-to-copy-the-content-of-a-cell-without-select