Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Check if more than one font is used in a cell?


Is there a way to find out, if more than one font is used in a cell?

The example below shows how to use different fonts in one cell.
I need to test if this is done and if it is done to get the differen
font objects.

Range("B5").Select
ActiveCell.FormulaR1C1 = "abcdef"
With ActiveCell.Characters(Start:=1, Length:=2).Font
.Superscript = False
End With
With ActiveCell.Characters(Start:=3, Length:=1).Font
.Superscript = True
End With
With ActiveCell.Characters(Start:=4, Length:=3).Font
.Superscript = False
End With
Range("B6").Selec

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default Check if more than one font is used in a cell?

You'd need to loop through all the characters using the Characters object.
The following code should get you started.


For i = 1 To Range("B5").Characters.Count
With Range("B5").Characters(i, 1).Font
MsgBox "Character " & vbTab & .Parent.Text & vbCrLf & _
"Color " & vbTab & .Color & vbCrLf & _
"Bold " & vbTab & .Bold & vbCrLf & _
"Superscript " & vbTab & .Superscript & vbCrLf & _
"Name " & vbTab & .Name
'etc
End With
Next i


Regards,
Vic Eldridge


Handler Robert wrote in message ...
Is there a way to find out, if more than one font is used in a cell?

The example below shows how to use different fonts in one cell.
I need to test if this is done and if it is done to get the different
font objects.

Range("B5").Select
ActiveCell.FormulaR1C1 = "abcdef"
With ActiveCell.Characters(Start:=1, Length:=2).Font
.Superscript = False
End With
With ActiveCell.Characters(Start:=3, Length:=1).Font
.Superscript = True
End With
With ActiveCell.Characters(Start:=4, Length:=3).Font
.Superscript = False
End With
Range("B6").Select


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Check if more than one font is used in a cell?

Just to check to see if there's more than one Font:

Option Explicit

Sub testme01()

Dim myFont As Variant
myFont = ActiveSheet.Range("a1").Font.Name
If IsNull(myFont) Then
MsgBox "multiple fonts"
Else
MsgBox "only one and it's: " & myFont
End If

End Sub

Not sure what you're doing, but here's a link that may give you an idea:

http://www.google.com/groups?threadm...ECE4%40msn.com

Handler Robert wrote:

Is there a way to find out, if more than one font is used in a cell?

The example below shows how to use different fonts in one cell.
I need to test if this is done and if it is done to get the different
font objects.

Range("B5").Select
ActiveCell.FormulaR1C1 = "abcdef"
With ActiveCell.Characters(Start:=1, Length:=2).Font
Superscript = False
End With
With ActiveCell.Characters(Start:=3, Length:=1).Font
Superscript = True
End With
With ActiveCell.Characters(Start:=4, Length:=3).Font
Superscript = False
End With
Range("B6").Select

------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/


--

Dave Peterson

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Check if more than one font is used in a cell?


Thanks for your answers.

With a combinatin of your answers,
I can first check, If a cell contains multiple fonts
and if yes, i have to check each character

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com

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
how I can Check the color of font in excel cell ? im-EGY Excel Worksheet Functions 2 September 21st 06 06:02 PM
Check Font? Bill Foster Setting up and Configuration of Excel 2 September 12th 06 10:55 PM
check box label font Joe D. Excel Discussion (Misc queries) 1 June 7th 06 08:47 PM
Font in Check Box Mon Excel Discussion (Misc queries) 1 November 25th 05 09:10 PM
check font colour Gareth[_3_] Excel Programming 2 October 29th 03 07:10 PM


All times are GMT +1. The time now is 04:22 AM.

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

About Us

"It's about Microsoft Excel"