Sub sqllll() Dim sql, rst, cnn, i, r Set cnn = CreateObject("adodb.connection") ReDim arr(1 To Sheets. Count - 1) r = 1 cnn. Open "dsn=excel files;dbq=" & ThisWorkbook. FullName For Each i In Worksheets If i. Name <> "汇总" Then arr(r) = "[" & i. Name & "$" & "]" r = r + 1 End If Next With ThisWorkbook.Sheets("汇总") r = .Cells(Rows.Count, 1).End(xlUp).Row For i = 1 To UBound(arr, 1) sql = "select * from " & arr(i) Set rst = cnn.Execute(sql) .Cells(r, 1) = "第" & i & "张表的数据" r = r + 1 .Cells(r, 1).CopyFromRecordset rst r = .Cells(Rows.Count, 1).End(xlUp).Row Set rst = Nothing Next End With End Sub