Sub test() Dim arr() As String Dim i As Integer For Each st In Sheets If st.Name <> "" Then i = i + 1 ReDim Preserve arr(1 To i) arr(i) = st.Name & "!A1" End If Next st Sheets("汇总表").Range("A1").Formula = "=" & Join(arr, "+") End Sub
Sub test() Dim arr() As String Dim i As Integer For Each st In Sheets If st.Name = "sheet & i + 1 " Then i = i + 1 ReDim Preserve arr(1 To i) arr(i) = st.Name & "!A1" End If Next st Sheets("汇总表").Range("A1").Formula = "=" & Join(arr, "+") End Sub