I'm creating a procedure which will return the year and month (number and character format) from 2 months ago.
For example, Month_2M should return the value for February, 02 but instead returns 2. This is an issue as I'm using these values to open a folder named '02. February 2021' but the current path opens '2. February 2021' which does not exist.
date1 = Format(Date, "DD")
'Declaring year value of 1 month
'This is important to compare datasets from last month
If date1 > 26 Then
Year_2M = Format(Date - 67, "YYYY")
Else
Year_2M = Format(Date - 57, "YYYY")
End If
'Declaring month value of 1 month
'This is important to compare datasets from last month
If date1 > 26 Then
Month_2M = Format(Date - 67, "MM")
Else
Month_2M = Format(Date - 57, "MM")
End If
'This translates the current month from number to character format
MonthChar_2 = MonthName(Month_2M, False)