Hi Guys,
So I use VBA to add the file names in a folder to excel. Everything works fine, but now I added a folder with other files. I now need the other folder file names to be added to the end of my existing data.
This is the VBA I currently use.
Sub ListAllFileNames1()
Dim strTargetFolder As String, strFileName As String, nCountItem As Integer
' Initialization
nCountItem = 1
strTargetFolder = "Z:\TC Reporting & Certification\Certificates Consolidated\House Brands Foods" & "\"
strFileName = Dir(strTargetFolder, vbDirectory)
' Get the file name
Do While strFileName <> ""
If strFileName <> "." And strFileName <> ".." Then
Cells(nCountItem + 3, 2) = strFileName
nCountItem = nCountItem + 3
End If
strFileName = Dir
Loop
End Sub
this is the other folder directory "Z:\TC Reporting & Certification\Certificates Consolidated\Appliances Medical Devices Cosmetics" & "\"
So basically I need the file names to be combined. The one following after the other.
So I use VBA to add the file names in a folder to excel. Everything works fine, but now I added a folder with other files. I now need the other folder file names to be added to the end of my existing data.
This is the VBA I currently use.
Sub ListAllFileNames1()
Dim strTargetFolder As String, strFileName As String, nCountItem As Integer
' Initialization
nCountItem = 1
strTargetFolder = "Z:\TC Reporting & Certification\Certificates Consolidated\House Brands Foods" & "\"
strFileName = Dir(strTargetFolder, vbDirectory)
' Get the file name
Do While strFileName <> ""
If strFileName <> "." And strFileName <> ".." Then
Cells(nCountItem + 3, 2) = strFileName
nCountItem = nCountItem + 3
End If
strFileName = Dir
Loop
End Sub
this is the other folder directory "Z:\TC Reporting & Certification\Certificates Consolidated\Appliances Medical Devices Cosmetics" & "\"
So basically I need the file names to be combined. The one following after the other.