PC Review


Reply
Thread Tools Rate Thread

NumberFormat property

 
 
JohnP
Guest
Posts: n/a
 
      25th Mar 2011
From Access 03 I can change the NumberFormat Property of an Excel 03
cell. For cell say F10 if original Date format was "dd/mm/yyyy"
I can change it to "m/d/yyyy"
objResultsSheet.Range(F10).NumberFormat = "m/d/yyyy"

Do you know what are the repercussions of this change? The cell value
was originally 14/3/2011. It still is and this logical since my
Regional Settings have not changed.

In other words what is the use of the NumberFormat property?

Thanks,
John




 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      25th Mar 2011
Numberformat only affects numbers -- and dates/times are considered numbers in
excel.

If you changed the numberformat and the display didn't change, then that cell
didn't really contain a number (or date or time).

That means that the original value is text -- not a real date.

If you have a column of these text strings that you want to convert to dates,
you can:

Select the column
Data|Text to columns
choose date (dmy)
and finish up

Then try the numberformat change.

But be aware that you may have real dates in that column of dates/strings.

01/02/2003
Could have been brought into your worksheet as January 2, 2003 or February 1,
2003 -- depending on how the data was imported and the short data format in
windows for that importer/user.

When I have to do this kind of stuff, I'll bring the values in as Text so excel
doesn't convert them to dates. Then I'd do the conversion and finally the
numberformatting.

And I usually use an unambiguous date format (mmmm dd, yyyy) to check against
the original source. Then use the format I like after this check.

On 03/25/2011 03:43, JohnP wrote:
> From Access 03 I can change the NumberFormat Property of an Excel 03
> cell. For cell say F10 if original Date format was "dd/mm/yyyy"
> I can change it to "m/d/yyyy"
> objResultsSheet.Range(F10).NumberFormat = "m/d/yyyy"
>
> Do you know what are the repercussions of this change? The cell value
> was originally 14/3/2011. It still is and this logical since my
> Regional Settings have not changed.
>
> In other words what is the use of the NumberFormat property?
>
> Thanks,
> John
>
>
>
>


--
Dave Peterson
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to set NumberFormat property of the PivotField class Seb Microsoft Excel Programming 1 18th Jan 2008 05:41 AM
Unable to set NumberFormat property of the PivotField class Seb Microsoft Excel Programming 0 6th Dec 2004 04:50 PM
Unable to set the NumberFormat Property of the Range Class - ERROR Jon Delano Microsoft Excel Programming 3 10th Nov 2004 08:33 PM
Better help in VBA for "NumberFormat Property" =?Utf-8?B?QmVuZ3QgTmlsc3NvbiwgU3RhZmZhbnN0b3JwLCBT Microsoft Excel Programming 2 10th Oct 2004 06:20 AM
Excel automation through .NET Interop: NumberFormat property looks like NumberFormatLocal martin durtschi Microsoft Excel Programming 0 19th Aug 2004 09:34 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:27 PM.