LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default trapping error

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error Trapping gazza67[_2_] Excel Discussion (Misc queries) 2 September 6th 07 06:11 PM
Trapping #VALUE! error RhysPieces Excel Discussion (Misc queries) 6 August 22nd 07 03:13 AM
Error Trapping from WSH Tom Chau Excel Discussion (Misc queries) 1 August 25th 06 04:21 AM
Error Trapping Neil Excel Programming 1 January 5th 04 04:38 PM
error trapping libby Excel Programming 5 November 25th 03 10:57 PM


All times are GMT +1. The time now is 05:31 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"