Excel TV ExcelTV

How to Change Comment Formatting – Excel VBA Coding Tips

Updated
How to Change Comment Formatting – Excel VBA Coding Tips

Excel MVP Jordan is continuing the Excel VBA Coding tips. While coding comments play an important role. Comments explain what certain piece of code does so that it would be easy when you share the code with others. So, Jordan unfolds the new coding tip related to comment. He explains the feature which adds color to comments. You can specify the text color and background color of the comment, so that when you look at the code, you would easily recognize the comments. So, let us see how to change comment formatting in Excel VBA.

How to Change Comment Formatting

In order to start writing VBA Code in Excel, we need to enable the ‘Developer’ tab first and we will see how to do that.

1 – Enable Developer Tab

Once you open the Excel Spreadsheet, click on ‘File’ and select ‘Options’. In ‘Excel Options’ dialog box, click on ‘Customize Ribbon’ on the left side. Check the option ‘Developer’ on the right side and click ‘Ok’. This would show the ‘Developer’ tab in your Excel Spreadsheet.

2 – Open the Visual Basic Editor

To open Visual Basic editor, click on ‘Visual Basic’ icon under ‘Developer’ tab. This would open the ‘Microsoft Visual Basic for Applications’ window where you can start writing the Visual Basic programs.

1

3 – Change Comment Formatting

In order to change comment formatting, click on ‘Tools’ and select ‘Options’.2

‘Options’ dialog box opens up and clicks on ‘Editor Format’ tab.

3

Now, under ‘Code Colors’ section, select ‘Comment Text’ and select Foreground color, Background color, Font type, Font size and more.

4

It even shows the preview and once you are ok with the formatting, click ‘Ok’

From now on when you type a comment in VBA Code, then you would see the format getting applied to comments.

What’s next?

Jordan has unfolded very useful VBA Coding tip. Give it a try and let us know your opinion or suggestion on it. If you have anything to add, please do share with us through comments.

Written by

Sridhar Belide
Sridhar BelideB.Tech. Computer Science, JNTUH10+ years in software engineering

Software Engineer, Wells Fargo

  • React
  • UI Frameworks
  • Front-end Development
Sridhar Belide is a skilled software engineer with over a decade of experience in the industry. Currently working at Wells Fargo since December 2018, he focuses on developing UI frameworks for front-end applications using React. Before joining Wells Fargo, Sridhar spent five years and four months at Tata Consultancy Services, where he held the position of IT Analyst. He also has experience as a Community Manager for Impact SoftTech Pvt. Ltd. EALP and as a Software Research and Development Engineer at NSN - Nokia Solutions and Networks. Sridhar holds a Bachelor of Technology (B.Tech.) in Computer Science from JNTUH, demonstrating his strong foundation in the field.

Read more articles by Sridhar Belide

Editorial standards

Fact Checking & Editorial Guidelines

Every article on Excel TV is held to a published editorial standard. The goal: accurate, current, and useful — without filler.

  1. Expert review. Drafts on technical Excel topics are reviewed by a contributor with hands-on, working knowledge of the feature being covered.
  2. Source validation. Claims about Excel behavior are tested in current Microsoft 365 builds. Third-party product claims are sourced from the vendor's own documentation.
  3. Disclosure. Affiliate links, sponsorships, and any commercial relationships that influenced a piece are disclosed in-line and at the foot of the article.
  4. Updates. Articles are revisited when Microsoft ships changes that affect the content. The most recent revision date is shown on every post.

Spot a problem? Email editor@excel.tv and we will look at it.

Subject-matter review

Reviewed by Subject Matter Experts

Technical Excel articles are reviewed by contributors with verifiable, hands-on experience in the topic — not generalist editors.

  • Qualified reviewers. Reviewers include Microsoft Excel MVPs, working business-intelligence practitioners, and Excel TV editorial staff. See each author's page for credentials.
  • Current to a known Excel build. Procedural articles state which Excel version they were validated against. Where Microsoft has since changed behavior, the article carries an inline update note.
  • Clarity check. Reviewers verify steps are reproducible by a reader at the assumed skill level — not just technically correct in a vacuum.

Want to contribute or review for Excel TV? See the about page.