Kalau pakai VBA dan PowerQuery (lebih cepat) di file xlfilefolderlist_vba_n_pq.xlsm Kalau pakai VBA dengan fitur FSO di file re-PATH.xlsm
Regards, Kid On Thu, Jul 11, 2019 at 5:10 PM y.ron...@yahoo.com [belajar-excel] < belajar-excel@yahoogroups.com> wrote: > > > Dear Master Vba, > > > Terlampir File untuk mencari Alamat File (Path). > > Yang Saya butuhkan, yaitu saat NEXT ke kolom berikutnya (B6) tanpa menimpa > kolom sebelumnya. Mohon dibantu koreksi scriptnya berikut: > > > > Sub Subfoldersandfolders() > > Dim FSO As Object > > Dim FSOFolder As Object > > Dim Objfile As Object > > Dim subfd As Object > > Dim x As String > > > > > > Application.FileDialog(msoFileDialogFolderPicker).Show > > x = Application.FileDialog(msoFileDialogFolderPicker).SelectedItems(1) > > Set FSO = CreateObject("Scripting.FileSystemObject") > > i = 3 > > Set FSOFolder = FSO.GetFolder(x) > > > 'Lis File in Folders > > For Each Objfile In FSOFolder.Files > > 'Cells(i, 1) = Objfile.Name > > Cells(i, 2) = Objfile.Path > > i = i + 1 > > Next > > > 'Lis File in SubFolders > > For Each subfd In FSOFolder.SubFolders > > For Each Objfile In subfd.Files.Count > > 'Cells(i, 1) = Objfile.Count > > Cells(i, 2) = Objfile.Path > > i = i + 1 > > Next > > Next > > End Sub > > > > > Terimakasih > > > > > > Regards, > > Roni > > >
xlfilefolderlist_vba_n_pq.xlsm
Description: application/vnd.ms-excel.sheet.macroenabled.12
re-PATH.xlsm
Description: application/vnd.ms-excel.sheet.macroenabled.12