2017-03-17 120 views

回答

1

這是一個四步的方法。 1.設計以純的話,像動作,

' loop through rows 103 to 148 in Sheet1 
' copy the row 
' loop through all other sheets in the workbook 
' paste the row in the first empty row at the bottom of each 
  • 研究每個動作的代碼。例如,谷歌的「VBA Excel循環行」

  • 令人驚訝的是,你會發現許多隨時可以使用的代碼,以及你會多快學會做不可能的事情。

  • 回到這裏有任何你自己無法解決的問題。

  • 0

    根據「我excel工作簿中的每張紙」的含義,這可能比通過所有其餘工作表循環粘貼操作要快。

    Sub galumph() 
        Dim w As Long, wss As String, wsa as Variant 
    
        For w = 2 To Worksheets.Count 
         wss = wss & IIf(CBool(Len(wss)), ";", vbNullString) & Worksheets(w).Name 
        Next w 
        wsa = Split(wss, ";")     'make array of worksheet names 
    
        Worksheets(1).Range("A103:Y148").Copy 'copy from A103:Y148 on Sheet1 
        Worksheets(wsa).Select     'select all of the remaining worksheets 
        Worksheets(wsa(0)).Range("A1").Activate 'activate the destination on one of the worksheets 
        Worksheets(wsa(0)).Paste    'paste the data into all worksheets 
    End Sub 
    
    相關問題