I agree with many of your comments (pun intended) but personally often add both comments of type “why” and “what”. Especially, I always add a comment at the top of the procedure or function explaining what it does. If needed, I also include a comment to the arguments and what is returned (for a function). Countless times - when modifying code I haven’t touched for many years - I’ve praised myself for having added “what” comments … especially in long procedures. Also, it’s not always that the variable names, or procedure/function names, are self explanatory. Ideally they would, perhaps, be … but then they wouldOftenBeQuiteLong (often much_longer_than_this_rather_long_explanation). ‘ Just my view
Great video. That example you provided with the headers in Excel data actually happened to me. I remember how difficult it was to figure out.
I agree with many of your comments (pun intended) but personally often add both comments of type “why” and “what”. Especially, I always add a comment at the top of the procedure or function explaining what it does. If needed, I also include a comment to the arguments and what is returned (for a function). Countless times - when modifying code I haven’t touched for many years - I’ve praised myself for having added “what” comments … especially in long procedures. Also, it’s not always that the variable names, or procedure/function names, are self explanatory. Ideally they would, perhaps, be … but then they wouldOftenBeQuiteLong (often much_longer_than_this_rather_long_explanation).
‘ Just my view
Thanks very much. Currently I am dealing with the code written in 2001!
I also still maintain code written in 2000/2001 (by me). Most of it would be a good "bad" example for the Better VBA series. ;)
Very Good.
Excellent video!
Depending on the complexity of Sub or Function I include a comment showing usage example.