DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
Altın Üyelik Hakkında Bilgi
Sub dosyalara_aktar()
Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim fso As Object, dosyalar, dosya, uzanti, Bolge As String
Dim i As Byte, k As Range, adr As String
If MsgBox("1.grup sayfasındaki verileri klasörün içinde bulunan " _
& "diğer dosyalara aktarmak istiyormusunuz?", vbYesNo, "EVREN") = vbNo Then Exit Sub
Sheets("1. grup").Select
Set fso = CreateObject("scripting.FileSystemObject")
Set dosyalar = fso.GetFolder(ThisWorkbook.Path).Files
Set conn = New ADODB.Connection
Set rs = New ADODB.Recordset
For Each dosya In dosyalar
If dosya.Name <> ThisWorkbook.Name Then
uzanti = "." & fso.getextensionname(dosya)
Bolge = Left(dosya.Name, Len(dosya.Name) - Len(uzanti))
conn.Open "Provider=Microsoft.Jet.oledb.4.0;Data Source=" & _
dosya & ";Extended Properties=""Excel 8.0;hdr=Yes;"""
rs.Open "Select * from [1.GRUP$];", conn, adOpenDynamic, adLockOptimistic
Set k = Range("A2:A" & Cells(65536, "A").End(xlUp).Row).Find(Bolge, , xlValues, xlWhole)
If Not k Is Nothing Then
adr = k.Address
Do
rs.AddNew
For i = 1 To 36
rs(i - 1).Value = Cells(k.Row, i).Value
Next
Set k = Range("A2:A" & Cells(65536, "A").End(xlUp).Row).FindNext(k)
Loop While Not k Is Nothing And k.Address <> adr
rs.Update
End If
rs.Close: conn.Close
End If
Next
Set rs = Nothing: Set conn = Nothing
MsgBox "Bilgiler Dosyalara Aktarıldı.", vbOKOnly + vbInformation, "evrengizlen@hotmail.com"
End Sub
Rica ederim.hocam çok teşekkür ederim