I want to update current date in a Libre Office Calc worksheet cell and add or less one day each in same cell using push button and macro. Please help me.
It is not exactly clear what you wish but here is a macro to increase the date in cell A1 by one day. Assign this to the Execute Action event of a push button. Duplicate the macro with the one line changed to decrease the date & attach to second push button.
Sub IncDate
oSheet=ThisComponent.CurrentController.ActiveSheet
Cell = oSheet.GetCellRangeByName("A1")
myDate = Cell.getString
currMonth = Month(myDate)
currDay = Day(myDate)
currYear = Year(myDate)
serialDate = DateSerial( currYear, currMonth, currDay )
'Replace next line with serialDate = serialDate-1 to decrease date
serialDate = serialDate+1
Cell.setString(serialDate)
End Sub
It works… Thank you