comments location in vba -opinion not question

lezawang

Well-known Member
Joined
Mar 27, 2016
Messages
1,805
Office Version
  1. 2016
Platform
  1. Windows
Hi
Where you usually write the comment about the sub you are writting? I created macro by recording steps and under Descrition: I wrote testing to my surprise excel created this code

Code:
Sub Macro3()
'
' Macro3 Macro
' testing
'


'
   
End Sub

I was expecting this
Code:
' Macro3 Macro
' testing
Sub Macro3()
End sub

Which style you do? Thanks
 
Last edited:

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
In my "early days" (I have been programming since 1981), I use the first method mainly because that is what others used; however, in my "later days" prior to my retirement (I retired in 2002), my preference was for the second method... I liked keeping internal comments reserved for explaining code lines and the external comment for a description of what the code is about/doing/for.
 
Last edited:
Upvote 0
I prefer the former....simply because that's what VBA does and that's what the majority expect ( I think !)
But having said that, Ricks comments make a lot of sense !!
 
Upvote 0

Forum statistics

Threads
1,214,875
Messages
6,122,046
Members
449,063
Latest member
ak94

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