VBA need to unbold data and grey color

sksanjeev786

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

I would like to unbold the data like A1,C2,C4,D1 and follwing and change it to grey color

Book1
ABCDEFG
17.5-7-1.17.22.15.7 p-1
24.57.63.65.53.6 p7.0 p14.1 p
34.42.60.36.8-0.20.111.3 p
41.774.1-0.62.83.66.1
59.515.5 p2.17.11.92.819.3 p
6351.631.82.19.4
75.3-5.7-1.211.31.73.210.1
Sheet1
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
You can select all the cells, then hit F5 key, select Special cells and option button Constants, uncheck Text checkbox, then okay.


1677867194344.png


The cells with just numbers will be selected and you can format.

1677867274697.png
 
Upvote 0
You can select all the cells, then hit F5 key, select Special cells and option button Constants, uncheck Text checkbox, then okay.


View attachment 86704

The cells with just numbers will be selected and you can format.

View attachment 86705
thanks for checking on this :):)

But i need to unbold A1,C2,C4,D1,D7,E1,E4,F4,F7,G6,G7 and need grey color for those data only.

Can we do this with above steps :)
 
Upvote 0
Try this.

VBA Code:
Sub unbold_Cells()
    Dim c As Range, r As Range

    For Each c In Range("A1:G100")
        If InStr(c, "p") = 0 Then
            If c.Font.Bold = True Then
                If r Is Nothing Then
                    Set r = c
                Else
                    Set r = Union(r, c)
                End If
            End If
        End If
    Next c
    
    r.Font.Color = 12566463
End Sub
 
Upvote 0
Try this.

VBA Code:
Sub unbold_Cells()
    Dim c As Range, r As Range

    For Each c In Range("A1:G100")
        If InStr(c, "p") = 0 Then
            If c.Font.Bold = True Then
                If r Is Nothing Then
                    Set r = c
                Else
                    Set r = Union(r, c)
                End If
            End If
        End If
    Next c
   
    r.Font.Color = 12566463
End Sub


Thank you so much Dev :) :)
 
Upvote 0

Forum statistics

Threads
1,224,827
Messages
6,181,194
Members
453,021
Latest member
pingpong7117

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