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: 47
Default determining if cell is a date or number using C#

How can one determine if the cell contains a number or a date using C#.
I have a column where users occassionally type the / for dates and
occassionally dont (because their ERP system accepts either format).
So the column contains a mix of values like:

9/16/05
103105

If the format is a date I want to convert from the (almost) dateserial value
otherwise I want to convert to a string and parse the month day year.
The value2 property returns double for both and I can't figure out how to
determine which format excel is using.
I tried to work around the issue using the text property to always return
the string and then I could check for the /. Unfortunatly I found that if
the column is not wide enough the text property returns #### so that wont
work either.

How do you get the current format of the cell?
Any ideas?

Thanks,
 
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
Determining an annual review date from an employee start date Phrank Excel Worksheet Functions 3 November 29th 07 06:37 AM
Formula for determining if two date columns fall within specific date range Igottabeme Excel Worksheet Functions 2 April 21st 06 02:50 AM
Formula for determining if two date columns fall within specific date range Igottabeme Excel Discussion (Misc queries) 1 April 20th 06 10:03 PM
need help determining a row number Gary Keramidas Excel Programming 7 November 13th 05 03:54 AM
Determining Row Number Wes Jester Excel Programming 2 August 26th 03 09:20 PM


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