Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Can I code Styles
If I run into a situaton where I have an addin formatting cells to a
particular style: ws.Column("D:D").style = "Currency" and the workbook that is active at the time does not have that style, is it possible to code the workbook or add the style to the workbook, prior to running the rest of the macro? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Can I code Styles
Why don't you record a macro as you create a style manually to see how it is
done? -- Jim "Wired Hosting News" wrote in message ... | If I run into a situaton where I have an addin formatting cells to a | particular style: | | ws.Column("D:D").style = "Currency" | | and the workbook that is active at the time does not have that style, is it | possible to code the workbook or add the style to the workbook, prior to | running the rest of the macro? | | |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Can I code Styles
You can test for it first and then rebuild it using those recorded statements:
Option Explicit Sub testme() Dim myStyle As Style Set myStyle = Nothing On Error Resume Next Set myStyle = ActiveWorkbook.Styles("Currency") On Error GoTo 0 If myStyle Is Nothing Then 'use your recorded code here to add the style Else 'it's already there, do nothing special End If End Sub Wired Hosting News wrote: If I run into a situaton where I have an addin formatting cells to a particular style: ws.Column("D:D").style = "Currency" and the workbook that is active at the time does not have that style, is it possible to code the workbook or add the style to the workbook, prior to running the rest of the macro? -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
missing styles | Excel Discussion (Misc queries) | |||
some unknown Cell styles are shown in cell styles | Excel Worksheet Functions | |||
Creating styles | Excel Discussion (Misc queries) | |||
Excel Cell Styles - Quick Styles? | Excel Discussion (Misc queries) | |||
Changing Customer Styles in Code | Excel Programming |