Be the first user to complete this post

  • 0
Add to List

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

Description:

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

Format:

DateValue(strString)

Arguments:
  • 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.

Example:

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
DateValue()
DateValue()



Also Read:

  1. VBA Excel - Cells, Ranges and Offset: Refer to Cells by Using Shortcut Notation
  2. VBA-Excel : Strings Functions – Instr
  3. VBA-Excel: String Functions – Len()
  4. VBA-Excel: Array Functions – IsArray()
  5. VBA-Excel: Arrays – One Dimension, Dynamic Array