2017-09-25 67 views

回答

0

指定波紋管命令按鈕。

Sub CommandButton() 
    Dim wb As Workbook 
    Set wb = Workbooks.Add(xlWBATWorksheet) 

    Dim sh As Long 
    Dim rg As Range 
    Dim Rng As Range 
    Dim rw As Range 

    Application.ScreenUpdating = False 

    For Each rw In Range("A3:I19").Cells 
    If rw.EntireRow.Hidden = False Then 
     If Rng Is Nothing Then Set Rng = rw 
     Set Rng = Union(rw, Rng) 
    End If 

    Next 

    Rng.Copy 

    With wb.Sheets("Sheet1") 

    sh = .Cells(Rows.Count, "A").End(xlUp).row + 2 

      .Activate 

     .Cells(sh, "A").Select 
    End with 

     ActiveSheet.Paste 

End Sub 
+0

'End With'丟失。 – AntiDrondert

+0

方面。謝謝。 – mgae2m

相關問題