Johan90
05-07-2018, 08:35 AM
So I have this macro that was working as it should but now it only list the first file. It adds the full path if I press yes on the message box as it should.
Anybody have any ideas?
Sub ListFilesinFolder()
Application.ScreenUpdating = False
Dim Value As String
Dim strt As Range
Set strt = Range("A10")
Value = Dir(Range("A5"), &H1F)
Do Until Value = ""
If Value <> "." And Value <> ".." Then
strt = Value
Set strt = strt.Offset(1, 0)
End If
Value = Dir
Loop
Range("A10").Select
MSBX1 = MsgBox("List full path to files incl file name (Ja). List only file name (Nej).", vbYesNo)
If MSBX1 = 6 Then
Dim dir2 As String
dir2 = Range("A5")
Do Until ActiveCell.Value = ""
ActiveCell.Value = dir2 & ActiveCell.Value
ActiveCell.Offset(1, 0).Range("A1").Select
Loop
End If
Range("A10").Select
Application.ScreenUpdating = True
End Sub
Anybody have any ideas?
Sub ListFilesinFolder()
Application.ScreenUpdating = False
Dim Value As String
Dim strt As Range
Set strt = Range("A10")
Value = Dir(Range("A5"), &H1F)
Do Until Value = ""
If Value <> "." And Value <> ".." Then
strt = Value
Set strt = strt.Offset(1, 0)
End If
Value = Dir
Loop
Range("A10").Select
MSBX1 = MsgBox("List full path to files incl file name (Ja). List only file name (Nej).", vbYesNo)
If MSBX1 = 6 Then
Dim dir2 As String
dir2 = Range("A5")
Do Until ActiveCell.Value = ""
ActiveCell.Value = dir2 & ActiveCell.Value
ActiveCell.Offset(1, 0).Range("A1").Select
Loop
End If
Range("A10").Select
Application.ScreenUpdating = True
End Sub