Cyberdude
11-09-2009, 04:50 AM
I just saw an interesting tip for adding comments to the end of a formula. In VBA when I want to add a comment to a statement line, I just preface the comment with an apostrophe ( ‘ ) like:
Range(“A1”).Select ‘This is a comment
To do something similar in a formula, the author says to add a sequence like:
+N(“Comment”)
The comment will be displayed in the formula line at the top of the screen, but will not be seen in the cell where the formula is written. Klutsy, but perhaps useful for documentation sometimes.
Note that the “N” is the “Value” function as used here. It attempts to convert the text comment into a number, but fails without generating an error message. Actually N generates a zero when it fails. It will always fail when trying to convert a text value.
Will this technique cause any kind of problem?
Range(“A1”).Select ‘This is a comment
To do something similar in a formula, the author says to add a sequence like:
+N(“Comment”)
The comment will be displayed in the formula line at the top of the screen, but will not be seen in the cell where the formula is written. Klutsy, but perhaps useful for documentation sometimes.
Note that the “N” is the “Value” function as used here. It attempts to convert the text comment into a number, but fails without generating an error message. Actually N generates a zero when it fails. It will always fail when trying to convert a text value.
Will this technique cause any kind of problem?