Styles.Add method (Excel)
Creates a new style and adds it to the list of styles that are available for the current workbook.
Syntax
expression.Add (Name)
expression A variable that represents a Styles object.
Parameters
Name | Required/Optional | Data type | Description |
---|---|---|---|
Name | Required | String | The new style name. |
Return value
A Style object that represents the new style.
Example
This example defines a new style based on cell A1 on Sheet1.
With ActiveWorkbook.Styles.Add("theNewStyle")
.IncludeNumber = False
.IncludeFont = True
.IncludeAlignment = False
.IncludeBorder = False
.IncludePatterns = False
.IncludeProtection = False
.Font.Name = "Arial"
.Font.Size = 18
End With
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.