VBA如何复制单元格的内容 [英] VBA How to copy the content of a cell without .Select
本文介绍了VBA如何复制单元格的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在编写一个可以使用 Target
的方法,并将该单元格完全粘贴到另一个单元格。这个单元格是一个运输标签,有一些花哨的形成。有没有办法我可以做?
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?
最初我有这样的:
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
推荐答案
Worksheets("Get Address").Range("A33").Copy _
Destination := Worksheets("Label").Range("A1")
这篇关于VBA如何复制单元格的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文