Be the first user to complete this post

  • 0
Add to List

VBA-Excel: Date-Time Functions – DateValue()


The DateValue() function converts string to a date and return it.



  • strString
    • Manda­tory
    • Type: String
    • String that needs to convert into date, if year is not provided then it will take the current year by default.


Function FnDateValue()

  Dim strDate1

  Dim strDate2

 strDate1 = "10-July-2000"

    strDate2 = "12-June"    

  MsgBox "Date Value of 10-July-2000 is " & DateValue(strDate1) & vbCrLf & "Date Value of 12-June is " & DateValue(strDate2)

End Function

Also Read:

  1. VBA-Excel: String Functions – LTrim()
  2. VBA-Excel : 3D-Ranges - Working with Multiple WorkSheets At The Simultaneously
  3. VBA-Excel: Date-Time Functions – IsDate()
  4. VBA-Excel: Select and Activate Cells - Select
  5. VBA-Excel: Get all the WeekDays or Working days in Specified Date Range, (excluding Satudays and Sundays)
  6. VBA-Excel: Fill Excel Range Values in a 2D Array
  7. VBA-Excel: String Functions – RTrim()
  8. VBA-Excel: String Functions – Len()