If text in cell is bold then ......

alkarkar

Board Regular
Joined
Sep 18, 2005
Messages
125
Hi everyone.
In every cell A1,A2,A3...A100 there is text (one or two words) which is/are bold or not.
I need to run a macro (or formula?) which will put in B1 the number 1 if text in A1 is bold or else to put number 2, in B2 the number 1 if text in A2 is bold or else to put number 2 .......... in B100 the number 1 if text in A100 is bold or else to put number 2 .
---A---------B-------
TREE-------1
GRASS----1
OCEAN-----2
CHILD-----1

Thanks Alex
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number

ktab

Well-known Member
Joined
Apr 21, 2005
Messages
1,297
Geia sou Alex,

Try this at a VBA standard module:
Code:
Sub test()
lastrow = Range("a65536").End(xlUp).Row
For i = 1 To lastrow
    If Cells(i, 1).Font.Bold = True Then
        Cells(i, 2) = 1
    Else: Cells(i, 2) = 2
    End If
Next i
End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,133,458
Messages
5,658,884
Members
418,475
Latest member
ExcelBeginner233

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
Top