Help with VBA Error Handling

jo15765

Well-known Member
Joined
Sep 23, 2011
Messages
591
I have never done any error handling, I would always just let the code crash, and pick up the pieces after the fact. Well this time I am going to try to add error handling, and what my thoughts are is to have the code say on error jump to the next and then show a log at the end of what failed. For example..
Code:
Workbooks.Open Filename:="C:\JJones\Daily\Daily.xls"
With Sheets(Array("Today", "Yesterday")).Select

And of course some of the array's are more complex and that is just a snippet. I was thinking something along the lines of if Today doesn't exist or a problem opening that, then proceed to Yesterday and then show me a log at the end of what the error(s) are.

Is that a feasible mindset or am I way out in left field? Also, how difficult would that be to code?
 
Hi Mark,

Yes, I was but a combination of babies and spreadsheet glare has aged me terribly! :)

Goodness, and I was suspecting moderator responsibilities after seeing Richard's updated pic!:eek:

Well if you see this, I'd much rather admit ignorance than stay that way... Who actually is the (presumably) mathematician?

As always, Cheers and best regards,

Mark
 
Upvote 0

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
It's "the old man" by Rubens actually - related to my former tagline as "Old Father Time" or something similar (more of Richard's cheek, which is actually what got him into his current position. ;))
 
Upvote 0
Ahh! Well I don't feel too bad then :), I was halfway guessing at da Vinci. Still too bad about Richard. I always thought he looked very comfortable plopped on the couch with his girls. The later condition, well....

Yack at you later and a great day to your and yours,

Mark
 
Upvote 0

Forum statistics

Threads
1,215,143
Messages
6,123,277
Members
449,093
Latest member
Vincent Khandagale

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top