Sub date () Dim todayDate As Date'Today's Date Dim todayDateMonth As Date'Today's Date (Monday) todayDate = Date todayDateMonth = Month (todayDate) End Sub
If i write the code as above,
The variable todayDate stores data as 2020/11/20,
The variable todayDateMonth contains 1900/01/10, which is completely different from the expected value "11".
I even investigated that such a value would be obtained if the serial type value was not assigned.
Then 2020/11/20 I don't know what it is,
After all, it didn't fall into my mind.
Can anyone please teach me?
Answer # 1
This is because todayDateMonth is declared as Date type.
Dim todayDateMonth As Integer
Try again as.
- excel - i want to display last month with a function
- how to press excel macro execution button in python
- i want to save a file using the urldownloadtofile function in excel vba, but the file is broken and it does not work
- function to automatically search the web for the product number entered in excel
- vba - excel macro suddenly malfunctions
- i want to use the horizontal function autofill in excel
- vba - create transcription macro from excel file to excel file (conditional)
- about vba (excel) addin macro
- vba - about excel macro
- vba - vlookup in excel macro
- i want to convert python csv to xlsx file, input excel function and read the value that came out
- (vbnet) i want to get the value value of a cell containing an excel function with closedxml
- can you build such a macro in excel? ? ?
- i want to use a function of excel to give a serial number
- vba - excel count function
- function - i want to calculate the total from the specified month to the month using arry formula
- excel vba function name = false meaning
- in excel vba, the aggregation macro of data from multiple books has stopped working
- python - how to know the arguments of a vba function in a protected excel file
- python - you may need to restart the kernel to use updated packages error
- php - coincheck api authentication doesn't work
- php - i would like to introduce the coincheck api so that i can make payments with bitcoin on my ec site
- [php] i want to get account information using coincheck api
- the emulator process for avd pixel_2_api_29 was killed occurred when the android studio emulator was started, so i would like to
- python 3x - typeerror: 'method' object is not subscriptable
- i want to call a child component method from a parent in vuejs
- dart - flutter: the instance member'stars' can't be accessed in an initializer error
- xcode - pod install [!] no `podfile 'found in the project directory