scubadivingfool
New Member
- Joined
- Jun 17, 2010
- Messages
- 35
OK, having trouble having two fonts in the same cell. I need to have the 2nd row, which is price and the unit of measure (ie. ea, dz, cs, pk). I was thinking of looking and seeing how the code works when I just work on one cell, but soon found that the activeCell.character is looking for a start and need for the first font and a start for the second font. Do to the fact that the price does change is size from 3 numbers including those after the decimal place to 4, 5 and 6 this method won't wok.
VBA Code:
Sub TwoFonts2()
Dim MyPos, SearchChar
SearchChar = "."
Rows("2:2").Select
With ActiveCell.Characters(Start:=1, Length:=8).Font
.Name = "ITC Avant Garde Std Bk"
.FontStyle = "Bold"
.Size = 26
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ThemeColor = xlThemeColorLight1
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
With MyPos = (InStr(SearchChar, x, " ") + 3)
.Name = "ITC Avant Garde Std Bk"
.FontStyle = "Bold"
.Size = 14
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ThemeColor = xlThemeColorLight1
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
End Sub