How to Find Bold Cells using VBA in Microsoft Excel 2010
How to Find Bold Cells using VBA in Microsoft Excel 2010. In this article, we will guide you on how to use VBA code to find bold cells in Microsoft Excel 2010. By creating a User-Defined Function (UDF), you can easily identify cells with bold font.
How to Find Bold Cells using VBA in Microsoft Excel 2010
Follow these steps:
- Enable the Developer tab: Click on the “File” tab, then select “Options.” In the Excel Options window, choose “Customize Ribbon.” Under the “Customize the Ribbon” section, check the box next to “Developer” and click “OK.”
- Access Visual Basic Editor: On the Developer tab, click on the “Visual Basic” button in the Code group. This will open the Visual Basic Editor.
- Create a new module: In the Visual Basic Editor, click on “Insert” and then select “Module.” This will create a new module.
- Add the VBA code: Enter the following code in the module:
Function FindBold(BoldRange As Range)
FindBold = BoldRange.Font.Bold
End Function
- Save the code: Save the VBA code by clicking on the “Save” button or by pressing Ctrl+S.
- Use the FindBold function: Now, you can use the newly created UDF function, FindBold, in your Excel worksheet. Simply enter the formula “=FindBold(A1)” in a cell to check if the font in cell A1 is bold. The function will return TRUE if the font is bold and FALSE if it is not.
By following these steps, you can utilize this VBA code in larger projects to automate tasks and identify bold cells in Excel.