Public Sub Sample()
Dim ws As Worksheet
Dim SheetName() As String
Dim cntSheet As Long
Dim i As Long
cntSheet = ThisWorkbook.Worksheets.Count - 1
ReDim SheetName(1 To cntSheet) As String
i = 1
For Each ws In ThisWorkbook.Worksheets
If ws.Name <> "Sheet1" Then
SheetName(i) = ws.Name & "!R1C1:R100C49"
i = i + 1
End If
Next ws
Sheet1.Range("A1").Consolidate Sources:=Array(SheetName), _
Function:=xlSum
End Sub
|