Forum Discussion

STEPHANMCGLASHAN86's avatar
STEPHANMCGLASHAN86
Copper Contributor
Sep 01, 2024

Find / Select bold cells

Hi, just wondering if anyone knows how to find / select all cells with bold numbers in a column? I've tried using find and replace many times. If I do it again and it tells me it "can't find" what im looking for, I will punch holes through both of my monitors. Please help.

  • NikolinoDE's avatar
    NikolinoDE
    Gold Contributor

    STEPHANMCGLASHAN86 

    Excel's "Find and Replace" feature does not natively support searching for cell formatting like bold text. However, you can use a simple VBA (Visual Basic for Applications) macro to find and select all bold cells in a column.

    Here’s how to do it:

    Using VBA to Find and Select Bold Cells

    1. Open the VBA Editor

    • Step 1: Press Alt + F11 to open the Visual Basic for Applications (VBA) editor.
    • Step 2: In the VBA editor, go to Insert > Module to insert a new module.

    2. Copy and Paste the VBA Code

    • Step 3: Copy and paste the following VBA code into the module:

    Vba Code is untested backup your file. VBA is not supported if you use Excel Online.

    Example in the attached file.

     

    Sub SelectBoldCells()
        Dim rng As Range
        Dim cell As Range
        Dim boldCells As Range
        
        ' Define the range you want to search in
        Set rng = Range("A1:A100") ' Adjust this range according to your needs
        
        For Each cell In rng
            ' Check if the cell's font is bold
            If cell.Font.Bold Then
                ' If this is the first bold cell found, set boldCells to it
                If boldCells Is Nothing Then
                    Set boldCells = cell
                Else
                    ' If more bold cells are found, add them to the range
                    Set boldCells = Union(boldCells, cell)
                End If
            End If
        Next cell
        
        ' If any bold cells were found, select them
        If Not boldCells Is Nothing Then
            boldCells.Select
        Else
            MsgBox "No bold cells found in the specified range."
        End If
    End Sub

     

     3. Run the Macro

     

    • Step 4: Close the VBA editor by pressing Alt + Q.
    • Step 5: Press Alt + F8, select SelectBoldCells, and click Run.

    Alternative: Conditional Formatting Trick (Without VBA)

    If you're not comfortable with VBA, here's a workaround using conditional formatting:

    • Step 1: Temporarily remove all formatting.
    • Step 2: Apply conditional formatting that mimics bold formatting (like changing the font or background color).
    • Step 3: Use "Find and Replace" to search for the conditional format you applied.

    This isn't as straightforward as the VBA approach, but it can be a workaround if you prefer not to use macros. The text and steps were edited with the help of AI.

     

    My answers are voluntary and without guarantee!

     

    Hope this will help you.

    Was the answer useful? Mark as best response and Like it!

    This will help all forum participants.

Resources