Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub ToManyPrices()
I can not seem to get this Error trap to work, when I find the first file that is not in the directory my msgbox works, when I find a 2nd file that is not in the dir the program crashes, could you advise why. Application.Goto Reference:="Dates2" Collectdat = Range("Dates2").Value If Range("f8") < "" Then BeYondDate = Range("f7", Range("f7").End(xlDown)) ' this gets the list of files to look for Range("f8", Range("f8").End(xlDown)).Clear Else Exit Sub End If For i =1 To UBound(BeYondDate) On Error GoTo Nofile Workbooks.OpenText Filename:="I:\My Documents\sharescope export\" & BeYondDate(i, 1) & ".prn", _ Origin:=xlMSDOS, StartRow:=2, DataType:=xlDelimited, TextQualifier:= _ xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=False, _ Comma:=True, Space:=False, Other:=False, FieldInfo:=Array(Array(1, 1), _ Array(2, 1), Array(3, 9), Array(4, 9), Array(5, 9), Array(6, 1), Array(7, 9)), _ TrailingMinusNumbers:=True Name = Range("a1") 'epic Importdat = Range("b1", Range("c1").End(xlDown)) 'shares dates Workbooks(BeYondDate(i, 1) & ".prn").Close False 'closes share file comparedat Nofile: MsgBox ("File " & "'" & BeYondDate(i, 1) & "'" & " not found in Sharescope Export") Next i End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Error Trapping | Excel Discussion (Misc queries) | |||
Trapping #VALUE! error | Excel Discussion (Misc queries) | |||
Error Trapping from WSH | Excel Discussion (Misc queries) | |||
Error Trapping | Excel Programming | |||
error trapping | Excel Programming |