What I am trying to make work is having labels that are located underneath these command buttons (which are on a userform) to show a specific MONTH and YEAR similar to what I have right now (and IS working) with how years are presented on some labels:
The code for the labels that show JUST the 'years' do work correctly (shown in the pic below) looks like this:
(so this is the code for the "2020" year that is circled:
(the "ALL" is a separate label and the caption says "(all")
So on the userform it appears like this:
The labels for the months however, have me stumped.
I can't have the caption directly read "Aug 2021" because I need to userform to be current with whatever the actual date is whenever the userform is opened each time (the same way that the 'year' label works that I showed above.)
For the first month label for "Aug 2021", I need it to be something like:
(But that code doesn't work on a userform as it was copied from a formula on one of the worksheets. Also, "Aug" is static and I need it to say "Aug" based on the current month minus 1 month...)
Can someone please provide me with code that works with a LABEL on a userform that will show what the correct MONTH is based on whatever the current month is NOW minus 1 month? (the label would show "Aug 2020")
Thanks in advance for any help.
The code for the labels that show JUST the 'years' do work correctly (shown in the pic below) looks like this:
(so this is the code for the "2020" year that is circled:
Code:
Me.lbl2020b.Caption = Format(Now, "yyyy") - 1
(the "ALL" is a separate label and the caption says "(all")
So on the userform it appears like this:
The labels for the months however, have me stumped.
I can't have the caption directly read "Aug 2021" because I need to userform to be current with whatever the actual date is whenever the userform is opened each time (the same way that the 'year' label works that I showed above.)
For the first month label for "Aug 2021", I need it to be something like:
Code:
="Aug "&TEXT(EDATE(TODAY(),-1),"yyyy")
(But that code doesn't work on a userform as it was copied from a formula on one of the worksheets. Also, "Aug" is static and I need it to say "Aug" based on the current month minus 1 month...)
Can someone please provide me with code that works with a LABEL on a userform that will show what the correct MONTH is based on whatever the current month is NOW minus 1 month? (the label would show "Aug 2020")
Thanks in advance for any help.