Thread: cell format
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
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