Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,942
Default 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

  #3   Report Post  
Posted to microsoft.public.excel.misc
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default 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

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,202
Default 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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
un-Bold part of text in a cell (automatically) chris Excel Discussion (Misc queries) 2 September 26th 07 10:21 PM
Detecting text and returning a value Confuddled User!!!!!!!!!!!!! Excel Discussion (Misc queries) 6 August 28th 07 04:04 PM
How do I get selected text within a cell to remain bold in excel? dixielady Excel Discussion (Misc queries) 2 May 27th 06 09:40 AM
Join bold and non-bold text in one cell bkincaid Excel Discussion (Misc queries) 3 March 21st 06 12:58 AM
Detecting Case of Text in a Cell Colin Vicary Excel Discussion (Misc queries) 2 October 19th 05 04:30 PM


All times are GMT +1. The time now is 03:11 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"