PC Review


Reply
Thread Tools Rate Thread

check format

 
 
Rolf G
Guest
Posts: n/a
 
      7th Oct 2008


Hello

Is it possible to check the fromat of a text, color and bold, in a cell?

Thanks

*** Sent via Developersdex http://www.developersdex.com ***
 
Reply With Quote
 
 
 
 
Rick Rothstein
Guest
Posts: n/a
 
      7th Oct 2008
Using the Characters.Font property of the cell - something like this
maybe...

Dim Status As String
With Range("A1").Characters.Font
If .Bold Then Status = "Bold, "
If .Italic Then Status = Status & "Italic, "
If .Strikethrough Then Status = Status & "Strikethrough, "
If .Shadow Then Status = Status & "Shadow, "
If .OutlineFont Then Status = Status & "OutlineFont, "
If .Subscript Then Status = Status & "Subscript, "
If .Superscript Then Status = Status & "Superscript, "
If .Underline Then Status = Status & "Underline, "
Status = Status & "Size=" & .Size & ", "
Status = Status & "ColorIndex=" & .ColorIndex
End With
MsgBox Status

--
Rick (MVP - Excel)


"Rolf G" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
>
> Hello
>
> Is it possible to check the fromat of a text, color and bold, in a cell?
>
> Thanks
>
> *** Sent via Developersdex http://www.developersdex.com ***


 
Reply With Quote
 
JLGWhiz
Guest
Posts: n/a
 
      7th Oct 2008
This will check the font size and wheter the font is bold in range B2.

Sub chkFont()
s = Range("B2").Font.Size
fs = Range("B2").Font.Bold
MsgBox s & " " & fs
End Sub



"Rolf G" wrote:

>
>
> Hello
>
> Is it possible to check the fromat of a text, color and bold, in a cell?
>
> Thanks
>
> *** Sent via Developersdex http://www.developersdex.com ***
>

 
Reply With Quote
 
JLGWhiz
Guest
Posts: n/a
 
      7th Oct 2008
To check the color, simply use ColorIndex instead of Size or Bold.

"Rolf G" wrote:

>
>
> Hello
>
> Is it possible to check the fromat of a text, color and bold, in a cell?
>
> Thanks
>
> *** Sent via Developersdex http://www.developersdex.com ***
>

 
Reply With Quote
 
Rick Rothstein
Guest
Posts: n/a
 
      7th Oct 2008
JLGWhiz is correct in using the Font property directly instead of vectoring
through the Characters property. Change the With statement in my posting to
this...

With Range("A1").Font

and use the rest of the code as posted.

--
Rick (MVP - Excel)


"Rick Rothstein" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Using the Characters.Font property of the cell - something like this
> maybe...
>
> Dim Status As String
> With Range("A1").Characters.Font
> If .Bold Then Status = "Bold, "
> If .Italic Then Status = Status & "Italic, "
> If .Strikethrough Then Status = Status & "Strikethrough, "
> If .Shadow Then Status = Status & "Shadow, "
> If .OutlineFont Then Status = Status & "OutlineFont, "
> If .Subscript Then Status = Status & "Subscript, "
> If .Superscript Then Status = Status & "Superscript, "
> If .Underline Then Status = Status & "Underline, "
> Status = Status & "Size=" & .Size & ", "
> Status = Status & "ColorIndex=" & .ColorIndex
> End With
> MsgBox Status
>
> --
> Rick (MVP - Excel)
>
>
> "Rolf G" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>>
>>
>> Hello
>>
>> Is it possible to check the fromat of a text, color and bold, in a cell?
>>
>> Thanks
>>
>> *** Sent via Developersdex http://www.developersdex.com ***

>


 
Reply With Quote
 
Rolf G
Guest
Posts: n/a
 
      8th Oct 2008




*** Sent via Developersdex http://www.developersdex.com ***
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Check if Conditional Format is True or False / Check cell Color =?Utf-8?B?S2V2aW4gTWNDYXJ0bmV5?= Microsoft Excel Worksheet Functions 5 29th Jun 2007 11:12 AM
Check Format =?Utf-8?B?U3R1ZGVudA==?= Microsoft Excel Programming 3 26th Oct 2006 03:56 PM
Check box format =?Utf-8?B?QW50aG9ueUo=?= Microsoft Excel Programming 1 12th Oct 2006 02:34 PM
Check Box Format! Kim-Anh Tran Microsoft Excel Programming 5 3rd May 2004 11:01 PM
Check Box Format =?Utf-8?B?VHJ1?= Microsoft Excel Misc 1 30th Apr 2004 06:21 PM


Features
 

Advertising
 

Newsgroups
 


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