VBA Find unbold data

sksanjeev786

Well-known Member
Joined
Aug 5, 2020
Messages
884
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi Team,

I have data in which green, Blue shaded data should be in Bold and grey shaded should be in unbold

but in below data while doing manual bold and unbold some greeen shadded coloer bold is miss

so i want to find out where ever i have miss bold

Book1
BCDEFG
241%16.143%15.363%8.7
3
439%15.239%4.249%20.2
545%20.445%6.564%12.9
6
793%0.990%4.495%-4.1
836%13.937%12.549%20.5
912%12.112%22.227%6.4
1044%14.244%15.161%12.9
11162/881168/819106/288
Sheet1
 
You are welcome.
I don't really understand your question about borders.
If you want to check cells which is not bold by border color. For that you can just replace cell.Interior.Color with cell.Border.Color
But also, you will need replace RGB code with color code of borders.
Hi

No i meant now we are getting output in Msg box where ever we don't have bold data in cell instead of that can we have a border on cell as as output
like if no bold on cell i need as a Cell border to identify easily in once view :)

same i have kept in images for ref..
1665785796258.png
 
Last edited:
Upvote 0

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Try this

VBA Code:
Sub is_BOLD()
Dim wb As Workbook
Dim ws As Worksheet
Dim rg As Range

Set ws = ActiveSheet
Set rg = ws.Range("B1:B10")

For Each cell In rg
If cell.Font.Bold = False And _
cell.Interior.Color = RGB(150, 193, 29) Then

    With cell.Borders(xlEdgeLeft)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlMedium
    End With
    With cell.Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlMedium
    End With
    With cell.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlMedium
    End With
    With cell.Borders(xlEdgeRight)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlMedium
    End With

ElseIf cell.Font.Bold = False And _
cell.Interior.Color = RGB(14, 173, 195) Then

    With cell.Borders(xlEdgeLeft)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlMedium
    End With
    With cell.Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlMedium
    End With
    With cell.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlMedium
    End With
    With cell.Borders(xlEdgeRight)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlMedium
    End With
End If

Next
End Sub

Don't forget to edit range: ws.Range("B1:B10")
 
Upvote 0
Try this

VBA Code:
Sub is_BOLD()
Dim wb As Workbook
Dim ws As Worksheet
Dim rg As Range

Set ws = ActiveSheet
Set rg = ws.Range("B1:B10")

For Each cell In rg
If cell.Font.Bold = False And _
cell.Interior.Color = RGB(150, 193, 29) Then

    With cell.Borders(xlEdgeLeft)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlMedium
    End With
    With cell.Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlMedium
    End With
    With cell.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlMedium
    End With
    With cell.Borders(xlEdgeRight)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlMedium
    End With

ElseIf cell.Font.Bold = False And _
cell.Interior.Color = RGB(14, 173, 195) Then

    With cell.Borders(xlEdgeLeft)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlMedium
    End With
    With cell.Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlMedium
    End With
    With cell.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlMedium
    End With
    With cell.Borders(xlEdgeRight)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlMedium
    End With
End If

Next
End Sub

Don't forget to edit range: ws.Range("B1:B10")

Perfect...:):)

thank you so much for your valuable time on this..

this made my day..!!! :)
 
Upvote 0
You are welcome. You can use this to check all columns at once. Change 20 to last column.
VBA Code:
Sub is_BOLD()
Dim wb As Workbook
Dim ws As Worksheet
Dim rg As Range
Dim i As Long

For i = 2 To 20 Step 2 '20 is number of last column
Set ws = ActiveSheet
Set rg = ws.Range(Cells(1, i), Cells(100, i))

For Each cell In rg
If cell.Font.Bold = False And _
cell.Interior.Color = RGB(150, 193, 29) Then

    With cell.Borders(xlEdgeLeft)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlMedium
    End With
    With cell.Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlMedium
    End With
    With cell.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlMedium
    End With
    With cell.Borders(xlEdgeRight)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlMedium
    End With

ElseIf cell.Font.Bold = False And _
cell.Interior.Color = RGB(14, 173, 195) Then

    With cell.Borders(xlEdgeLeft)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlMedium
    End With
    With cell.Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlMedium
    End With
    With cell.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlMedium
    End With
    With cell.Borders(xlEdgeRight)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlMedium
    End With
End If

Next
Next i
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,480
Messages
6,125,050
Members
449,206
Latest member
Healthydogs

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top