LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
dan
 
Posts: n/a
Default On Error GoTo skip needs help

"Subscript out of range" appeared when a non existant file was entered,
and the execution was aborted.
Can you help me to continue the execution?

Sub Analyse()
Dim Ans As Variant
Dim filename As String
Sheets("Sheet1").Select
Ans = InputBox(prompt:="Enter the data file name. ")
If Ans = "" Then Exit Sub
filename = Ans & ".csv"
On Error GoTo skip
Workbooks.Open filename:="F:\Cabinet1\" & filename, UpdateLinks:=0
' Main analysis body here
Exit Sub
skip:
Windows("ABC").Activate
Sheets("Sheet1").Range("H1") = Ans & " file does not exist!"
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
Skip a cell that contains data slowdiver Excel Worksheet Functions 1 January 22nd 06 02:38 PM
Cond Format:re color 2 cols, skip 2 cols Tat Excel Worksheet Functions 2 June 22nd 05 06:43 PM
How do I skip blank cells when copying over a range of cells? tawells Excel Discussion (Misc queries) 2 June 7th 05 09:36 PM
Even after selecting "skip blanks" in the paste special menu in e. arudra1974 Excel Discussion (Misc queries) 1 February 19th 05 02:59 PM
Skip the holidays Aviator Excel Discussion (Misc queries) 6 January 11th 05 08:13 PM


All times are GMT +1. The time now is 02:26 AM.

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

About Us

"It's about Microsoft Excel"