Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 417
Default Worksheet Calculate

I had no trouble at all using VBA to assign this format to a cell:

Sub FormatPctNonZero()
Selection.NumberFormat = "#,##0.00%;-#,##0.00%;;@"
End Sub

Alternatively, if you have a Style (i.e. "PctNonZero [1]") defined that
applies this format, then the VBA code would look like the following:

Sub FormatPctNonZeroStyle()
Selection.Style = "PctNonZero [1]"
End Sub

Just be aware that to use this method, the Style must exist in the
workbook, otherwise you will get the following run-time error (at least in
Excel 2000):

"Run-time error '450':
"Wrong number of arguments or invalid property assignment."

--
Regards,
Bill Renaud



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
worksheet calculate RobcPettit[_2_] Excel Programming 4 August 3rd 06 11:09 PM
Worksheet will not calculate jk85016 Excel Discussion (Misc queries) 1 May 19th 06 02:41 PM
how do i set up a worksheet to calculate the inventory? mumbai Excel Worksheet Functions 1 March 17th 06 12:16 PM
Can I calculate just one worksheet in a multi-worksheet workbook? Captive Thinker Excel Discussion (Misc queries) 3 March 2nd 06 10:36 AM


All times are GMT +1. The time now is 08:08 AM.

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

About Us

"It's about Microsoft Excel"