22/04/2021, 01:36
feraz
Aslında düşününce union all olayına gerek yok abey ektekini deneyin.
Private Sub CommandButton1_Click()
Dim rs As Object, con As Object
Set rs = CreateObject("ADODB.Recordset")
Set con = CreateObject("ADODB.Connection")
Dim yol As String, yol2 As String
yol = ThisWorkbook.Path & Application.PathSeparator
yol2 = Dir(yol & "*xlsx")
With ThisWorkbook.Sheets("TümVeri")
.Range("A2:Q" & Rows.Count).Clear
Do Until yol2 = ""
con.Open "Provider=microsoft.ace.oledb.12.0;data source=" & yol & yol2 & ";extended properties=""Excel 12.0;hdr=yes"""
rs.Open "select * from [MEMURLAR$]", con, 1, 1
.Range("A" & Rows.Count).End(3)(2, 1).CopyFromRecordset rs
rs.Close
con.Close
yol2 = Dir
Loop
End With
Set rs = Nothing
Set con = Nothing
MsgBox "Bitti", vbInformation, "Bilgi"
End Sub