Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Changing a cell's number format
I am trying to change the number of decimal places displayed in a given cell
when a macro is executed. Everything I've read says a simple command using the code Selection.NumberFormat = "0.00" should work but for some reason the cell format remains unchanged. I've tried changing the default cell format to both General and Number first but this has not helped. Why is this command not working and what would rectify this? Thx. Chris |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Changing a cell's number format
Are you sure the number format isn't changing? After running the macro,
what format do the cell(s) have (checking in Format/Cells/Number)? If your numbers are entered as Text, their display won't be affected by number format. If the cell indicates a number format, but your displayed text doesn't reflect that format, try copying an empty cell, selecting your "numbers", and choosing Edit/Paste Special, selecting the Values and Add radio buttons. This will coerce any "Text numbers" into numbers. In article , "Chris" wrote: I am trying to change the number of decimal places displayed in a given cell when a macro is executed. Everything I've read says a simple command using the code Selection.NumberFormat = "0.00" should work but for some reason the cell format remains unchanged. I've tried changing the default cell format to both General and Number first but this has not helped. Why is this command not working and what would rectify this? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Changing a cell's number format
Unfortunately neither of those helped. Yes, the cells are displaying the
Number format when I check them. I have also tried running the macro on sample cells or fields that I know are unconnected to anything else to try to isolate the problem and still I cannot get the cell format to change. Strange.... Other ideas? Chris "JE McGimpsey" wrote: Are you sure the number format isn't changing? After running the macro, what format do the cell(s) have (checking in Format/Cells/Number)? If your numbers are entered as Text, their display won't be affected by number format. If the cell indicates a number format, but your displayed text doesn't reflect that format, try copying an empty cell, selecting your "numbers", and choosing Edit/Paste Special, selecting the Values and Add radio buttons. This will coerce any "Text numbers" into numbers. In article , "Chris" wrote: I am trying to change the number of decimal places displayed in a given cell when a macro is executed. Everything I've read says a simple command using the code Selection.NumberFormat = "0.00" should work but for some reason the cell format remains unchanged. I've tried changing the default cell format to both General and Number first but this has not helped. Why is this command not working and what would rectify this? |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Changing a cell's number format
Thanks for the help. After further trouble-shooting I found another macro
running in the background that was causing the NumberFormat feature not to work. Works great now, thanks. "Chris" wrote: Unfortunately neither of those helped. Yes, the cells are displaying the Number format when I check them. I have also tried running the macro on sample cells or fields that I know are unconnected to anything else to try to isolate the problem and still I cannot get the cell format to change. Strange.... Other ideas? Chris "JE McGimpsey" wrote: Are you sure the number format isn't changing? After running the macro, what format do the cell(s) have (checking in Format/Cells/Number)? If your numbers are entered as Text, their display won't be affected by number format. If the cell indicates a number format, but your displayed text doesn't reflect that format, try copying an empty cell, selecting your "numbers", and choosing Edit/Paste Special, selecting the Values and Add radio buttons. This will coerce any "Text numbers" into numbers. In article , "Chris" wrote: I am trying to change the number of decimal places displayed in a given cell when a macro is executed. Everything I've read says a simple command using the code Selection.NumberFormat = "0.00" should work but for some reason the cell format remains unchanged. I've tried changing the default cell format to both General and Number first but this has not helped. Why is this command not working and what would rectify this? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Get cell's number format category in VBA? | Excel Discussion (Misc queries) | |||
Changing the format of a phone number | Excel Worksheet Functions | |||
Changing Phone number format | Excel Worksheet Functions | |||
Changing number format | Excel Worksheet Functions | |||
Changing format of number without changing the value | Excel Discussion (Misc queries) |