2024年4月30日星期二

vba PasteFormat

Option Explicit
Sub PasteFormat()

    Dim fromRow As Integer
    Dim sRow As Integer
    Dim eRow As Integer
    
    fromRow = 6
    sRow = 7
    
    Rows(fromRow & ":" & fromRow).Select
    Selection.Copy
    
    Dim thisSheet As Worksheet
    Set thisSheet = ActiveSheet
    fromRow = 6
    sRow = 7
eRow = thisSheet.UsedRange.Rows.Count
Rows(sRow & ":" & thisSheet.UsedRange.Rows.Count).Select Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _ SkipBlanks:=False, Transpose:=False Application.CutCopyMode = False End Sub

没有评论: