#1   Report Post  
Posted to microsoft.public.excel.programming
SMH SMH is offline
external usenet poster
 
Posts: 29
Default time error

I have an application in EXCEL using macros. The program has to read an empty
cell which should give a value 12:00:00 AM for all blank empty cells. On one
machine it works but on a another PC this does not work.

The cell when read (using the same spreadsheet) reads 00:00:00 rather than
12:00:00 AM or PM in the second machine. I have tried all sorts of formats
and even entered 12:00:00 PM in the cell but the value read is always
00:00:00 and so themacro does not work on the second machin.First machine is
running window xp professional and the second machine (where the problem is )
is running windows home. Both machines are running the same version of excel.

What is the cell format that I should enter in the second machine so the the
cells will read 12:00:00 rather than 00:00:00

thanks in advance
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default time error

On Sun, 26 Jun 2005 07:53:02 -0700, SMH wrote:

I have an application in EXCEL using macros. The program has to read an empty
cell which should give a value 12:00:00 AM for all blank empty cells. On one
machine it works but on a another PC this does not work.

The cell when read (using the same spreadsheet) reads 00:00:00 rather than
12:00:00 AM or PM in the second machine. I have tried all sorts of formats
and even entered 12:00:00 PM in the cell but the value read is always
00:00:00 and so themacro does not work on the second machin.First machine is
running window xp professional and the second machine (where the problem is )
is running windows home. Both machines are running the same version of excel.

What is the cell format that I should enter in the second machine so the the
cells will read 12:00:00 rather than 00:00:00


h:mm:ss AM/PM

However, the cell format is NOT your problem.

The cell format only controls what is DISPLAYED in the cell. It has no effect
over what is STORED in that cell. The Value (or contents) (cell.value) of a
cell that displays the time 12:00:00 AM is zero (0), and the Value of a cell
that displays the time 12:00:00 PM will be 0.5.

Perhaps a more robust fix for your macro would be to look at the .value
property rather than the .text property of the cells you are checking.

Here are some examples:

?[a1].text
12:00:00 AM
?[a1].value
0
?[a2].text
12:00 PM
?[a2].value
0.5


--ron
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
Visual Basic Error Run Time Error, Type Mismatch Meg Partridge Excel Discussion (Misc queries) 12 September 10th 08 06:10 PM
Run time error 1004, General ODBC error [email protected] New Users to Excel 0 September 19th 05 01:41 AM
Run time error '1004': Generaol ODBC error Dwaine Horton[_3_] Excel Programming 2 April 26th 05 02:52 PM
Befuddled with For Next Loop ------ Run - Time Error '13' Type Mismatch Error rdavis7408 Excel Programming 1 August 25th 04 03:54 AM
Code Error - Run Time Error 5 (Disable Cut, Copy & Paste) Tim[_36_] Excel Programming 4 April 23rd 04 02:53 AM


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

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

About Us

"It's about Microsoft Excel"