Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
how I can Check the color of font in excel cell ? | Excel Worksheet Functions | |||
Check Font? | Setting up and Configuration of Excel | |||
check box label font | Excel Discussion (Misc queries) | |||
Font in Check Box | Excel Discussion (Misc queries) | |||
check font colour | Excel Programming |