View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default Date dd-mm-yy(EXCEL) manipulation in VB macro

Sub test()
Dim dt As Date
Dim d As Long, m As Long, y As Long

Range("a1") = Now ' or Date

dt = Range("A1").Value

d = Day(dt)
m = Month(dt)
y = Year(dt)

Debug.Print d, m, y

End Sub

press ctrl-g to see the debug results in the Immediate window

Regards,
Peter T


"nanda via OfficeKB.com" <u54234@uwe wrote in message
news:9b2a3a8507635@uwe...
I want to manipulate date entered in excel sheet using VB macro, ie want
to
extract day, moth and year separately from the date entered in EXCEL sheet
(in dd-mm-yy format )and store it in three different variables. but since
the
formats used in excel is dd-mm-yy and VB is mm/dd/yy could any body please
code a function to do the same Thanks very much

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200908/1