OfficeDocs-Support
OfficeDocs-Support copied to clipboard
Comments in code blocks are broken
The ' symbol is supposed to start a line comment in VB but the text highlighting of the code blocks seems to treat it as a string character. If you look at this screenshot https://prnt.sc/13o51vq you can see the issue.
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: acccdfec-a453-acfe-e138-222c37599706
- Version Independent ID: d2719065-14c8-94a7-6505-52dd0b67b6b1
- Content: Loop through a list of data on a worksheet by using macros - Office
- Content Source: Office/Client/excel/loop-through-data-using-macro.md
- Product: office-perpetual-itpro
- GitHub Login: @helenclu
- Microsoft Alias: luche
@yoraaf The code itself is correct. It works if you compile it. What exactly would you change in the article?
@VLG17 The issue is not with the code itself, but with the syntax highlighting. If you look on the page, all text between two ' characters is highlighted as if its a string instead of it highlighting only one line as a comment. This also results in some comments being highlighted as if it is code instead of being highlighted as a comment.
The code seems to compile and I can step through it in Excel just fine. Maybe they should use Copy instead of text highlighting for coping the code over?
Since my original post, the issue has already been fixed. To clarify, my issue was never with the code itself (I know that it runs and compiles fine) but with the way the website handled the highlighting of said code (as you can see in my original screenshot). Here is a screenshot comparing how it looked before and after it was fixed https://i.imgur.com/saXFsl3.png
I hope this has finally clarified what my original problem was, and with that I will close this issue as it has been fixed already.