Excel TV

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.

Sridhar Belide
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.