Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I'm using Excel 97. I have a vba function that puts values in specific cells. To do so, I'm naming each cell and referencing it like so: dim varMyPercent as variant varMyPercent = 0.02 wb.Names("metric1000").RefersToRange.Value = varMyPercent Here, the cell referred to by metric1000 is already formatted as a % with 0 decimal points. The problem is that Excel seems to (somewhat randomly) convert the cell to a time format (e.g. 0.02 gets displayed as 12:28:48 AM) I can do the above algorithm for 100 cells and perhaps 2-5 cells will get converted display in the time format. There doesn't seem to be any consistency as to how Excel does this and it's definitely not wanted. Any ideas how to prevent this from happening? I tried prefixing the value with an apostrophe but this causes Excel to ignore the formatting in the cell. Thanks, Michael D |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Converting text format of time/date into Excel time/date for subtr | Excel Worksheet Functions | |||
Converting time to decimal format | Excel Worksheet Functions | |||
Converting a time format to a String format in Excel | Excel Discussion (Misc queries) | |||
Converting Text to Time format of XX:XX | Excel Discussion (Misc queries) | |||
Converting to Time Format | Excel Discussion (Misc queries) |