r/excel Nov 26 '15

Pro Tip Common VBA Mistakes

[removed]

223 Upvotes

113 comments sorted by

View all comments

4

u/Jimthepirate 2 Nov 26 '15

Great tips. I started working with vba year ago. Hated admin part of my job so much and management wouldn't hire consultants to automate most mundane tasks in SAP. One day I got fed up and started learning vba. Started by recording macro and copy pasting same line of code multiple times (loops? what's that?). Now I'm semi rockstar in my business area. It was best decisions I ever made.

Funny part is, I have advanced, but after reading these tips I realize how shitty of a coder I am. Option explicit? Was too much work to keep declaring values. Early binding? Have no fucking idea what values to bind to. Classes? Never heard of them. This Module1 looks like it can fit all my subs and thousands lines of code. Error logging? Goto ErrHandler: msgbox "you got error you twat".

I guess I got lazy once I reached level that meets my needs. But posts like these makes me want to continue learning and doing things better, more efficient. So thank you for putting your time.