![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Apr 2002
Posts: 14
|
Hi All,
I need to save a value into a certain cell, formatting it as currency with 0 decimal places. How do I do this? I know of the Format function, but don't know how to control the decimal places. - Activesheet.Cells(1,2) = Format(ListPrice,"currency") - I cannot pre-format the cell using the Excel menu because my code requires all cells in the worksheet to be Cleared (Using "Clear All") before this statement. I'd really applreciate any help on this. Thanks! Manish |
|
|
|
|
|
#2 |
|
Board Regular
Join Date: Apr 2002
Location: Sarasota, FL
Posts: 1,539
|
try adding this code to the worksheet:
Sub Workbook_Open() Sub Workbook_Open() Cells.Select Selection.NumberFormat = "#,##0" Range("A1").Select Application.CalculateFull End Sub and if you need a symbol, substitute this in: Selection.NumberFormat = "$#,##0" -Corticus |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Feb 2002
Location: Dog Beach, Florida. Yeaahh!
Posts: 4,038
|
You can get the code Corticus sent you, and much, much more, by recording a keyboard macro.
Click on Tools-Macro-Record New Macro-O.K. Click on Format-Cells-Number-Currency and set the decimal place to zero. Click on Tools-Macro-Stop Recording. Walla, mansewer!
__________________
Barry- Photo Restoration/Enhancement http://www.smiledogproductions.com click below for detour
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|