Vishal.Gawade
New Member
- Joined
- Mar 23, 2009
- Messages
- 7
Hi Team,
I am getting run time error in below code even after getting all correct result. Marked the debug area with yellow words.
Please chck & advice.
Sub findfile()
Mydir = "Y:\13_Banking\001_Bank statements\" & Range("C4").Value & "\" & Range("C5").Value & "\" & Range("C6").Value & "\" & Range("C7").Value & "\*.*"
RowCount = 5
First = True
Do While (1)
If First = True Then
MyFilename = Dir(Mydir)
First = False
Else
MyFilename = Dir
End If
If MyFilename = "G" Then Exit Do
Cells(RowCount, "G") = MyFilename
RowCount = RowCount + 1
Loop
End Sub
Thank you,
Vishal
I am getting run time error in below code even after getting all correct result. Marked the debug area with yellow words.
Please chck & advice.
Sub findfile()
Mydir = "Y:\13_Banking\001_Bank statements\" & Range("C4").Value & "\" & Range("C5").Value & "\" & Range("C6").Value & "\" & Range("C7").Value & "\*.*"
RowCount = 5
First = True
Do While (1)
If First = True Then
MyFilename = Dir(Mydir)
First = False
Else
MyFilename = Dir
End If
If MyFilename = "G" Then Exit Do
Cells(RowCount, "G") = MyFilename
RowCount = RowCount + 1
Loop
End Sub
Thank you,
Vishal