如何用VBA实现格式刷的功能?

1.

http://club.excelhome.net/thread-373686-1-1.html


复制1格式Selection.CopyFormat
粘贴格式Selection.PasteFormat

 

2.

http://www.excelpx.com/thread-116445-1-1.html

Sub Macro1()
  Dim Rng As Range
    Set Rng = ActiveCell
    Rng.Copy
    ActiveSheet.UsedRange.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
        SkipBlanks:=False, Transpose:=False
    Application.CutCopyMode = False
    Rng.Select
End Sub

有效!

操作:先用鼠标选择源单元格 --- 再运行上述代码 进行全部格式化

3.

http://www.excelpx.com/thread-139764-1-1.html

    Set QY1 = Sheet1.Cells(I, 1).Resize(1, 7)
    Set qy2 = Sheet2.Cells(I + 1, 10).Resize(1, 7)
    QY1.Copy
    qy2.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
        SkipBlanks:=False, Transpose:=False
    Application.CutCopyMode = False

 

 

VBA粘贴

posted @ 2019-01-13 21:05  行走的思想  阅读(5940)  评论(0编辑  收藏  举报