Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default excel vba date format prob.

I have a problem with formating the dates in my macro, when the macro is
done i need to go into the cell and press <enter! but as I need this
action to take place in the macro, how do I do this??????

I have tried for a month and nothing happens!!

Y.S.
Jo


---
Message posted from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default excel vba date format prob.

Hi

Make sure your macro knows it's really a date before pasting by using a date variable. I
also suggest to use Dateserial for setting this, (y, m, d) , then you are independent of
the computer's regional settings and formats.

Sub Macro1()
Dim D As Date
D = DateSerial(2004, 1, 30)
Range("A1").Value = D
'and if you want to:
'Range("A1").NumberFormat = "dddd mmm.d yyyy"
End Sub

--
HTH. Best wishes Harald
Followup to newsgroup only please.

"jo11 " wrote in message
...
I have a problem with formating the dates in my macro, when the macro is
done i need to go into the cell and press <enter! but as I need this
action to take place in the macro, how do I do this??????

I have tried for a month and nothing happens!!

Y.S.
Jo


---
Message posted from http://www.ExcelForum.com/



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
Printing from excel prob. rakaca Excel Discussion (Misc queries) 1 June 15th 09 07:35 PM
Weird prob: Format 3rd condition for other than first two Sue in AZ[_2_] Excel Worksheet Functions 5 February 5th 08 11:12 PM
Date prob with Pivot Table jct Excel Discussion (Misc queries) 1 January 1st 06 08:43 PM
Excel Prob.....What functions? aeiou Excel Discussion (Misc queries) 2 August 3rd 05 06:49 PM
Excel 2000 date format cannot be set to Australian date format Brian Jones Excel Discussion (Misc queries) 1 March 30th 05 06:03 AM


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

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"