I'm trying to consolidate data from a few files (eg 01Aug.xls, 02Aug.xls, 03Aug.xls ....etc). For dates that fall on a Sat, Sun or public holiday, there will not be any file. I have the below VBA code. I put in the dates in column A of excel sheet, and the files are saved in C:\Documents and Settings\Simon\Desktop\VBA\VBE\.
My question is, how do i make it work such that if the file is not available, the macro will select the go to the next date and carry on till it reaches the last date Thanks.
Dim filedate As String
Dim times As Integer
times = times + 1
filedate = Range("A" & times).Value
Workbooks.Open Filename:= _
"C:\Documents and Settings\Simon\Desktop\VBA\VBE\" & filedate & ".xls"
Range("B" & times).Select
Loop While times < 10
Microsoft ISV Community Center Forums1