ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   add column (https://www.excelbanter.com/excel-programming/383949-add-column.html)

geebee

add column
 
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


Gary''s Student

add column
 
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
--
Gary''s Student
gsnu200708


"geebee" wrote:

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


merjet

add column
 
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




All times are GMT +1. The time now is 07:24 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com