'Comments In Code

Seeing the code at Smitty's link reminds me to point out that that will also whack everything after an apostrophe that appears in a literal string (e.g., "'Sheet Bob'!A1"), so you should go line by line, not Replace All.
 
To whack all comments, do Find & Replace, tick Use Pattern Matching, and replace '* with nothing.
. Wow! That simple. Great, Thanks. (Any reason why you used blue for '* ?)
Alan
P.s. For any German viewers: tick Mit Mustervergleich rather than tick Use Pattern Matching.
 
Hey DocAElstein,

Here is a snippet of one code line:

Code:
Function ColorFunction(rColor As Range, rRange As Range, Optional SUM As Boolean)
'#@ This is a comment *
Dim rCell As Range

I can see your point. However I find the red easier to find and less strain on my eyes then the green. I too would be called a late starter. For the VBA part of Excel anyways. I have been using plain excel spreadsheets for 10 years now.

If you notice I also put an "*" asterisk at the end of my comments. I keep hoping that Microsoft will implement a way to search for a starting character and ending character so that I can find whole lines rather then be limited to one word searches.

That is why I was saying that I may look for a way to write some VBA that can do it in the future. Other than that I am not sure if there is a way to accomplish what we would like to do. If you find a way please let me know or update this thread.

later

Ty

Hi Again,
. Thanks for reply above
. Our bit of chating was worth it. We got some good answers.
. Both solutions work for me.
. Thanks again also to shg and Smitty
Alan
 
Here's a link to some code that will do it as well:

VBA Express : Excel - Remove All Comments from a VBA Project

Although I'd think that when you're posting examples the comments would be welcome.

Hey Smitty,

Have you tried using this. There isn't any comments (lol) indicating what it does as the code runs. I like that there is code, but want to make sure that I can modify it to look for specifc text blocks so that it removes the correct comments.

thanks in advance.

later

Ty
 
Seeing the code at Smitty's link reminds me to point out that that will also whack everything after an apostrophe that appears in a literal string (e.g., "'Sheet Bob'!A1"), so you should go line by line, not Replace All.

Hey shg,

Yeah, I actually did that when I tried what you posted so I could see each line it highlighted. Thanks again.

later

Ty
 

Forum statistics

Threads
1,214,979
Messages
6,122,552
Members
449,088
Latest member
davidcom

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