#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 216
Default cell format

I've set a column of cells to be formatted as mm/dd/yyyy,
however when i move the date value of one of these cells
to a string variable, the value in the variable is
displayed as my regional option for the short date which
is mmddyy. Is there a way around this. Can you set the
regional system options with VBA and then reset when the
spreadsheet application is closed?

Thanks,
Mike
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default cell format

Dim sStr as String
sStr = Range("A1").Text

Demoing from the immediate window:

range("A1").Value = Date
range("A1").NumberFormat = "mmmm dd, yyyy"
? range("A1").Value
1/3/04
? range("A1").Text
January 03, 2004
sStr = range("A1").Text
? sStr
January 03, 2004


--
Regards,
Tom Ogilvy


Mike wrote in message
...
I've set a column of cells to be formatted as mm/dd/yyyy,
however when i move the date value of one of these cells
to a string variable, the value in the variable is
displayed as my regional option for the short date which
is mmddyy. Is there a way around this. Can you set the
regional system options with VBA and then reset when the
spreadsheet application is closed?

Thanks,
Mike



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
Lock Cell Format - Allow copy and paste of data without format change Chris12InKC Excel Worksheet Functions 2 May 9th 23 07:42 PM
cell format - remove cell format pattern without effecting colors Bas Excel Discussion (Misc queries) 1 March 23rd 09 02:54 PM
Can cell format come from and change with reference cell format jclouse Excel Discussion (Misc queries) 1 November 29th 06 03:20 AM
how do i format a cell based on format of a range of cells? Chris Hardick Excel Discussion (Misc queries) 2 April 3rd 06 08:54 AM
How do I copy data in single cell format to a merged cell format Paul Excel Discussion (Misc queries) 1 June 27th 05 11:00 AM


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