Samle liste i celle
HejNogen der kan give mig en løsning på at få samlet en liste igen. Det er den fede del der er problemet, det andet giver det ønsket resultat. ændre fra DK til UK på 3 plads.
outputtet jeg ønsker er c:\test\uk\ i stedet for c:\test\dk\ og i tilfælde af flere mapper gælder det samme c:\test\uk\folder1\folder2\ i stedet for c:\test\dk\folder1\folder2\
Sub SrchForFiles()
Dim i As Long, z As Long, Rw As Long
Dim ws As Worksheet
Dim y As Variant
Dim fLdr As String, fil As String, FPath As String
Dim MyTempList As Variant
Dim MyTempList2 As Variant
Dim lfldrnm As Integer
Dim FldrName As String
Dim FilName As String
Dim sTmp As String
Dim t As Long
Dim l As Variant
Dim ll As Variant
Dim filell As String
Dim p As String
With Application.FileDialog(msoFileDialogFilePicker)
.Show
l = .SelectedItems(1)
End With
MyTempList2 = Split(l, "\")
For t = 0 To UBound(MyTempList2)
Next t
Filenamel = MyTempList2(UBound(MyTempList2))
y = Filenamel
Application.ScreenUpdating = False
With Application.FileSearch
.NewSearch
.LookIn = "C:\test\DK"
.SearchSubFolders = True
.Filename = y
On Error GoTo 0
If .Execute() > 0 Then
For i = 1 To .FoundFiles.Count
fil = .FoundFiles(i)
'Get file path from file name
MyTempList = Split(fil, "\")
For t = 0 To UBound(MyTempList)
Next t
Filename = MyTempList(UBound(MyTempList))
MyTempList(2) = "UK"
Next i
End If
End With
[b]Cells(1,1).Value = MyTempList(0) & "\" & ... & "\" & MyTempList(UBound - 1) & "\" [b]
End Sub
thx.
