DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
Altın Üyelik Hakkında Bilgi
Merhaba,
Aşağıdaki kodu kullanın.
Kod:Sub VeriAl() dosya = [a6].Text [b6] = Application.ExecuteExcel4Macro("'" & ThisWorkbook.Path & "\a\[" & dosya & "]Sayfa1'!R1C1") End Sub
Sub dosya_al()
Dim fso As Object, fs As Object, sat As Long
Set fso = CreateObject("Scripting.FileSystemObject")
Range("A:A").ClearContents
For Each fs In fso.getfolder(ThisWorkbook.Path & "\a").Files
If Right(fs.Name, 4) = ".xls" Then
sat = sat + 1
Cells(sat, "A").Value = Left(fs.Name, Len(fs.Name) - 4)
yol = ThisWorkbook.Path & "\a\"
Dosya = fs.Name
Cells(sat, "B").Value = Application.ExecuteExcel4Macro("'" & yol & "[" & Dosya & "]Sayfa1'!R1C1")
End If
Next
MsgBox "Dosyalar A sütununa yazıldı."
End Sub
Kodunuzu aşağıdaki ile değiştirin.
Kod:Sub dosya_al() Dim fso As Object, fs As Object, sat As Long Set fso = CreateObject("Scripting.FileSystemObject") Range("A:A").ClearContents For Each fs In fso.getfolder(ThisWorkbook.Path & "\a").Files If Right(fs.Name, 4) = ".xls" Then sat = sat + 1 Cells(sat, "A").Value = Left(fs.Name, Len(fs.Name) - 4) yol = ThisWorkbook.Path & "\a\" Dosya = Left(fs.Name, Len(fs.Name)) Cells(sat, "B").Value = Application.ExecuteExcel4Macro("'" & yol & "[" & Dosya & "]Sayfa1'!R1C1") End If Next MsgBox "Dosyalar A sütununa yazıldı." End Sub
Eğer dosyalarınıza 0 değerleri girmeyecekseniz, aşağıdaki kodu kullanabilirsiniz. Böylece boş hücrelere 0 değeri vermemiş olur.şahane oldu çok teşekkür ederim.![]()
Sub dosya_al()
Dim fso As Object, fs As Object, sat As Long
Set fso = CreateObject("Scripting.FileSystemObject")
Range("A:A").ClearContents
For Each fs In fso.getfolder(ThisWorkbook.Path & "\a").Files
If Right(fs.Name, 4) = ".xls" Then
sat = sat + 1
Cells(sat, "A").Value = Left(fs.Name, Len(fs.Name) - 4)
yol = ThisWorkbook.Path & "\a\"
hucre = Application.ExecuteExcel4Macro("'" & yol & "[" & fs.Name & "]Sayfa1'!R1C1")
If hucre <> 0 Then
Cells(sat, "B").Value = hucre
End If
End If
Next
MsgBox "Dosyalar A sütununa yazıldı."
End Sub