I have found that Excel 2000 does not allow the end-user to specify a single atomic attribute; one cannot have a style "Bold" which sets just the Bold attribute without disturbing the Font, Font size and other attributes of the style. Indeed, Excel 2000 protests to the end-user if the end-user deletes the Font (name) and Font size from the text boxes.
So I turned to VBA, and have discovered that the restrictions appear to be insoluble.
The macro below, edited from a recorded macro, attempts to define a style that is solely a font size of 24 points.
Applying the style defined by the macro causes my cell contents, previously styled "Courier" to revert to "Arial", even though the Arial font (name) is disabled in the macro that defines style "Size24".
Code: Select all
Sub AddStyleSize24()
ActiveWorkbook.Styles.Add Name:="Size24"
With ActiveWorkbook.Styles("Size24")
.IncludeNumber = False
.IncludeFont = True
.IncludeAlignment = False
.IncludeBorder = False
.IncludePatterns = False
.IncludeProtection = False
End With
With ActiveWorkbook.Styles("Size24").Font
' .Name = "Arial"
.Size = 24
' .Bold = True
' .Italic = True
' .Underline = xlUnderlineStyleNone
' .Strikethrough = False
' .ColorIndex = xlAutomatic
End With
' Selection.Style = "Size24"
End Sub