Martin_H
Board Regular
- Joined
- Aug 26, 2020
- Messages
- 190
- Office Version
- 365
- Platform
- Windows
Hi team,
I would like to slightly modify the code below, which is a small part of bigger macro:
So basically, if today's month is February and I am trying to run macro specified only for the month of March, code will tell me "Not yet available."
If today's month is March and I am trying to run macro specified for the month of March, code will continue without any message box.
As you can see, code compare today's date to the specific month (3rd month in this case.
I need to inclued today's year to the code.
For example:
Today's year is 2022.
Today's month is February (2).
So when I run macro specified for March, it will obviously stop, because it is only February, but when I open Workbook from year 2021 and run macro specified for the month of March (2021) it will continue because that is the past.
I hope it is clear, if not let me know please and I will be more specific.
I would like to slightly modify the code below, which is a small part of bigger macro:
VBA Code:
If Month(Date) < 3 Then
MsgBox "Not yet available.", vbExclamation
Exit Sub
End If
So basically, if today's month is February and I am trying to run macro specified only for the month of March, code will tell me "Not yet available."
If today's month is March and I am trying to run macro specified for the month of March, code will continue without any message box.
As you can see, code compare today's date to the specific month (3rd month in this case.
I need to inclued today's year to the code.
For example:
Today's year is 2022.
Today's month is February (2).
So when I run macro specified for March, it will obviously stop, because it is only February, but when I open Workbook from year 2021 and run macro specified for the month of March (2021) it will continue because that is the past.
I hope it is clear, if not let me know please and I will be more specific.