Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
missing styles Sys-Stat Excel Discussion (Misc queries) 3 April 10th 10 11:50 PM
some unknown Cell styles are shown in cell styles Vaibhav Dhawade Excel Worksheet Functions 0 March 6th 10 05:11 AM
Creating styles GKW in GA Excel Discussion (Misc queries) 3 March 24th 08 12:33 AM
Excel Cell Styles - Quick Styles? Dean@DCF Excel Discussion (Misc queries) 0 November 15th 07 10:40 PM
Changing Customer Styles in Code Sherry[_4_] Excel Programming 2 November 28th 03 05:19 PM


All times are GMT +1. The time now is 06:47 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"