Skip to main content

AccessTr.neT


Klasör İçerisindeki Excel Dosyalarını Tek Dosyada Birleştirme

Klasör İçerisindeki Excel Dosyalarını Tek Dosyada Birleştirme

#28
referans eklenmiş ve sıralanmış haliyle dosya eklenmiştir
okla gösterilen alanlar ekleme süresini görmek içindir, silinebilirler
Private Sub CommandButton1_Click()
t1 = Now'<--Silinebilir
Dim con As ADODB.Connection
Set con = New ADODB.Connection
con.Open "provider=microsoft.ace.oledb.12.0;data source=" & ThisWorkbook.FullName & ";extended properties=""excel 8.0;hdr=yes;"""

yol = ThisWorkbook.Path & Application.PathSeparator
yol2 = Dir(yol & "*xlsx")

With ThisWorkbook.Sheets("TümVeri")
.Range("A2:Q" & Rows.Count).Clear
Do Until yol2 = ""
txtSql = "INSERT INTO [TümVeri$] " & _
"SELECT * " & _
"FROM [MEMURLAR$] IN '" & yol & yol2 & "'[EXCEL 8.0;] " & _
"where ([SİCİL] Is Not Null);"
con.Execute txtSql

yol2 = Dir
Loop
If WorksheetFunction.CountA(.Range("B2:B" & Rows.Count)) > 0 Then
son = .Range("B" & Rows.Count).End(3).Row
.Range("A2").Value = 1
.Range("A2:A" & son).DataSeries Rowcol:=xlColumns, Type:=xlLinear, Date:=xlDay, Step:=1, Stop:=son
End If
'Alan dönüşüm_______________________________________
.Range("B2:B" & son).NumberFormat = "0"
.Range("B2:B" & son).Value = .Range("B2:B" & son).Value
.Range("D2Lol" & son).NumberFormat = "0"
.Range("D2Lol" & son).Value = .Range("D2Lol" & son).Value
.Range("F2Lol" & son).NumberFormat = "0"
.Range("F2:F" & son).Value = .Range("F2:F" & son).Value
'_________________________________________________
End With

con.Close: Set con = Nothing

t2 = Now'<--Silinebilir
Debug.Print "Tur", t1, t2, DateDiff("s", t1, t2)'<--Silinebilir
MsgBox "Bitti", vbInformation, "Bilgi"
End Sub
.rar 00 -Tüm Veri_hy.rar (Dosya Boyutu: 21,64 KB | İndirme Sayısı: 3)
Cevapla

Bir hesap oluşturun veya yorum yapmak için giriş yapın

Yorum yapmak için üye olmanız gerekiyor

ya da

Bu Konudaki Yorumlar
RE: Klasör İçerisindeki Excel Dosyalarını Tek Dosyada Birleştirme - Yazar: berduş - 23/04/2021, 02:24
Task