add column

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi,

I have a sheet withi like 500 or so rows. There is a column B with some of
the values in Bold. I would like to add a column to the sheet which puts a
"BOLD" in each row/column if the value in column B is bolded, and a value of
"NOT" if it is not bolded. Is there a programmatic/fast way of doing this?

Thanks in advance,
geebee
 
Sub boldchk()
n = Cells(Rows.Count, 2).End(xlUp).Row
Range("C1").EntireColumn.Insert
For i = 1 To n
If Cells(i, 2).Font.Bold = True Then
Cells(i, 3).Value = "BOLD"
Else
Cells(i, 3).Value = "NOT"
End If
Next
End Sub
 
Sub macro1()
Dim c As Range
Dim rng As Range

Set rng = Sheets("Sheet1").Range("B1:B500")
For Each c In rng
If c.Font.FontStyle = "Bold" Then
Sheets("Sheet1").Range("H" & c.Row) = "BOLD"
Else
Sheets("Sheet1").Range("H" & c.Row) = "NOT"
End If
Next c
End Sub

Change row numbers and columns to suit.

Hth,
Merjet
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top