LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Excel keeps converting my %s to Time format

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
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
Converting text format of time/date into Excel time/date for subtr YY san.[_2_] Excel Worksheet Functions 6 February 25th 10 08:27 AM
Converting time to decimal format dwhapp Excel Worksheet Functions 17 November 26th 08 06:54 PM
Converting a time format to a String format in Excel Bill Partridge Excel Discussion (Misc queries) 3 October 3rd 07 11:48 AM
Converting Text to Time format of XX:XX Marck Excel Discussion (Misc queries) 3 February 25th 06 03:48 PM
Converting to Time Format Amber Excel Discussion (Misc queries) 1 July 7th 05 10:56 PM


All times are GMT +1. The time now is 12:18 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"