Apr 20 2021 09:54 AM
There is date appearing as 02/28/2021 in cell B6 in the attached excel sheet. I want that when the "Previous Month" button is selected, the date in cell B6 should change to 01/31/2021. Similarly when button "Next Month" is selected, the date in cell B6 should change to 03/31/2021.
I don't how this can be achieved but it is of utmost important to achieve this. Any similar idea/s is/are also welcomed.
Thanks.
Apr 20 2021 10:22 AM
This can be done with a couple of macros. See the attached version - now a .xlsm workbook.
Make sure that you allow macros when you you open the workbook.
P.S. The value in cell B6 was a text value, I converted it to a 'real' date.
Apr 20 2021 11:18 AM
@Hans Vogelaar Thanks a lot for the solution. yes, it works exactly as I wanted.
But it would be great if you can specify each step by step as I need to have multiple similar macros to be enabled in other workbooks too.
Apr 20 2021 11:28 AM
SolutionI did the following:
Sub PrevMonth()
End Sub
Sub PrevMonth()
Range("B6").Value = Application.EoMonth(Range("B6").Value, -1)
End Sub
Apr 22 2021 12:22 AM
I was wondering if you can help me to have the same result in Google Sheet then it would be double thumbs up to you.
Apr 22 2021 12:29 AM
I have very little experience with Google Sheets, sorry.
Apr 20 2021 11:28 AM
SolutionI did the following:
Sub PrevMonth()
End Sub
Sub PrevMonth()
Range("B6").Value = Application.EoMonth(Range("B6").Value, -1)
End Sub