+ Reply to Thread
Results 1 to 2 of 2

IF Exists or on Error Then - Skip Code- How to write code?

  1. #1
    Forum Contributor Jack7774's Avatar
    Join Date
    08-31-2012
    Location
    Georgia, US
    MS-Off Ver
    Excel 2010
    Posts
    576

    Question IF Exists or on Error Then - Skip Code- How to write code?

    The Workbooks.open filename seen below prompts an error because it does not exist. I want a way to either check if the workbook exists and if it does then continue code and if it doesn't then skip part of the code and resume. Or I want a way to on error of trying to open workbook skip this part of code and resume at this place. I believe either one will work but i am not fimilar with the If and objects enought to know how to write it as i am self taught. If you reply with an answer and put it into the code please also list the answer outside of the code as well please in a seperate code window. Thanks.

    Workbooks.Open Filename:= _
    "I:\ACCOUNTING\Clear Payments\2013\2013-01\Completed\DATE6_GA_LocationSummaryReport.xls"
    Columns("A:A").Select

    Please Login or Register  to view this content.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: IF Exists or on Error Then - Skip Code- How to write code?

    You can use the Dir function to check if a file exists.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1