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

Hi,
Is there a way that I can convert month and year numbers into dates in
vba analagous to the "=Date()" function in excel. For instance, how
can I convert 12/2005 into a date number in vba without using "=Date"
in a worksheet cell?

Thanks,
Andrew

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default text to date

Hi Andrew,

Try:

'=============
Public Sub Tester002()
Dim DTE As Date

DTE = DateValue("12/2005")
MsgBox DTE

End Sub
'<<=============


---
Regards,
Norman



"andrew" wrote in message
oups.com...
Hi,
Is there a way that I can convert month and year numbers into dates in
vba analagous to the "=Date()" function in excel. For instance, how
can I convert 12/2005 into a date number in vba without using "=Date"
in a worksheet cell?

Thanks,
Andrew



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,440
Default text to date

Hi Andrew,

use the DateValue function, directly available in VBA

--
Kind regards,

Niek Otten


"andrew" wrote in message
oups.com...
Hi,
Is there a way that I can convert month and year numbers into dates in
vba analagous to the "=Date()" function in excel. For instance, how
can I convert 12/2005 into a date number in vba without using "=Date"
in a worksheet cell?

Thanks,
Andrew



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default text to date

Thanks! This is great

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
Date format to Text Date for use in Mail Merge Erinayn Excel Discussion (Misc queries) 3 April 22nd 10 06:04 AM
how do i convert text to date (mm/yy text to mm/dd/yyyy date)? lindsey Excel Discussion (Misc queries) 1 July 27th 07 10:05 PM
Concatenating a Text and a Date without losing orginal Date Format Hi_no_Tori Excel Discussion (Misc queries) 5 September 17th 06 06:35 PM
Help: How do I convert a text date into a real date format japorms Excel Worksheet Functions 4 August 2nd 06 06:36 PM
Change text to date and check against date in cell RW Excel Programming 3 February 2nd 06 03:29 PM


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