==============================
==============================
Description
The Microsoft Excel DATESERIAL function returns a date given a year, month, and day value.The DATESERIAL function is a built-in function in Excel that is categorized as a Date/Time Function. It can be used as a VBA function (VBA) in Excel. As a VBA function, you can use this function in macro code that is entered through the Microsoft Visual Basic Editor.
Syntax
The syntax for the DATESERIAL function in Microsoft Excel is:DateSerial( year, month, day )
Parameters or Arguments
- year
- A numeric value between 100 and 9999 that represents the year value of the date.
- month
- A numeric value that represents the month value of the date.
- day
- A numeric value that represents the day value of the date.
Returns
The DATESERIAL function returns a date value.Applies To
- Excel 2016, Excel 2013, Excel 2011 for Mac, Excel 2010, Excel 2007, Excel 2003, Excel XP, Excel 2000
Type of Function
- VBA function (VBA)
Example (as VBA Function)
The DATESERIAL function can only be used in VBA code in Microsoft Excel.Let's look at some Excel DATESERIAL function examples and explore how to use the DATESERIAL function in Excel VBA code:
DateSerial(2004, 6, 30)For example:
Result: "6/30/2004"
DateSerial(2004-1, 6, 30)
Result: "6/30/2003"
DateSerial(2004, 6-2, 14)
Result: "4/14/2004"
Dim LDate As DateIn this example, the variable called LDate would now contain the value of "5/31/2004"
LDate = DateSerial(2004, 5, 31)
ليست هناك تعليقات:
إرسال تعليق