ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   count non bolded items (https://www.excelbanter.com/excel-programming/319327-count-non-bolded-items.html)

Annette[_4_]

count non bolded items
 
Is it possible to write a macro on the above subject line .. and insert
blank row in A1 so as to put in the result?



Bob Phillips[_6_]

count non bolded items
 
Annette,

Here is one way.

Dim i As Long
Dim cLastRow As Long
Dim cNonBold As Long

cLastRow = Cells(Rows.Count, "A").End(xlUp).Row
For i = 1 To cLastRow
If Not Cells(i, "A").Font.Bold Then
cNonBold = cNonBold + 1
End If
Next i
Range("A1").EntireRow.Insert
Range("A1").Value = "Num non-bold cells = " & cNonBold

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Annette" wrote in message
...
Is it possible to write a macro on the above subject line .. and insert
blank row in A1 so as to put in the result?





Annette[_4_]

count non bolded items
 
This is just too clever ... thank you!

"Bob Phillips" wrote in message
...
Annette,

Here is one way.

Dim i As Long
Dim cLastRow As Long
Dim cNonBold As Long

cLastRow = Cells(Rows.Count, "A").End(xlUp).Row
For i = 1 To cLastRow
If Not Cells(i, "A").Font.Bold Then
cNonBold = cNonBold + 1
End If
Next i
Range("A1").EntireRow.Insert
Range("A1").Value = "Num non-bold cells = " & cNonBold

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Annette" wrote in message
...
Is it possible to write a macro on the above subject line .. and insert
blank row in A1 so as to put in the result?








All times are GMT +1. The time now is 02:04 PM.

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