![]() |
Is there way of detecting whether a cell is Bold text?
I have a very large spreadsheet of some data that someone else entered.
They have separated groups in the sheet by using Bold text for the first line. I know this is a poor way of doing it but it is too late to change. It is OK when viewing the spreadsheet but I would like to transfer it to ACCESS because of its size. I would like to detect the lines with bold text so that I can add a flag in a new column to identify them. Is there any way of doing this? -- JMB |
Is there way of detecting whether a cell is Bold text?
hi
assuming that all the text in each line is bold you might do a loop Sub test1() Dim rg As Range Dim rgd As Range Set rg = Cells(1, 1) Do While Not IsEmpty(rg) Set rgd = rg.Offset(1, 0) If rg.Font.Bold Then rg.end(xlright).offset(0,1).value = "Flag" End If Set rg = rgd Loop End Sub regards FSt1 "JMB" wrote: I have a very large spreadsheet of some data that someone else entered. They have separated groups in the sheet by using Bold text for the first line. I know this is a poor way of doing it but it is too late to change. It is OK when viewing the spreadsheet but I would like to transfer it to ACCESS because of its size. I would like to detect the lines with bold text so that I can add a flag in a new column to identify them. Is there any way of doing this? -- JMB |
Is there way of detecting whether a cell is Bold text?
Thanks, getting a bit late so will have a play on a small test sheet tomorrow.
-- JMB "FSt1" wrote: hi assuming that all the text in each line is bold you might do a loop Sub test1() Dim rg As Range Dim rgd As Range Set rg = Cells(1, 1) Do While Not IsEmpty(rg) Set rgd = rg.Offset(1, 0) If rg.Font.Bold Then rg.end(xlright).offset(0,1).value = "Flag" End If Set rg = rgd Loop End Sub regards FSt1 "JMB" wrote: I have a very large spreadsheet of some data that someone else entered. They have separated groups in the sheet by using Bold text for the first line. I know this is a poor way of doing it but it is too late to change. It is OK when viewing the spreadsheet but I would like to transfer it to ACCESS because of its size. I would like to detect the lines with bold text so that I can add a flag in a new column to identify them. Is there any way of doing this? -- JMB |
Is there way of detecting whether a cell is Bold text?
If you know that the entire first line is bold, meaning you know the first
character is bold, guaranteed, then this User Defined Function will work for you... Function IsFirstLineBold(CellAddr As Range) As Boolean Application.Volatile IsFirstLineBold = CellAddr.Characters(1, 1).Font.Bold End Function If, on the other hand, the first line can "look" bold, but possibly have non-bolded leading blank spaces, then this more general function (it out if there is a bold character anywhere in the cell) would probably be what you want... Function IsAnythingBold(CellAddr As Range) As Boolean Dim X As Long Application.Volatile For X = 1 To Len(CellAddr.Value) If CellAddr.Characters(X, 1).Font.Bold Then IsAnythingBold = True Exit For End If Next End Function By the way, if you are not familiar with User Defined Function... you would go into the VBA editor, Insert a Module and then paste one of the functions above into its code window; then just put this... IsFirstLineBold(A1) <<<or =IsAnythingBold(A1) into B1 (use your own cell references in place of the A1 and B1). Rick "JMB" wrote in message ... I have a very large spreadsheet of some data that someone else entered. They have separated groups in the sheet by using Bold text for the first line. I know this is a poor way of doing it but it is too late to change. It is OK when viewing the spreadsheet but I would like to transfer it to ACCESS because of its size. I would like to detect the lines with bold text so that I can add a flag in a new column to identify them. Is there any way of doing this? -- JMB |
All times are GMT +1. The time now is 07:23 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com