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/ |
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/ |
All times are GMT +1. The time now is 06:55 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com