Hi everyone!
I know this is a question that has been asked millions of times but I can’t find a working solution
I would like that when I insert a data in column H, the date is automatically inserted in column A (in the relative row) and the time in column B.
I have searched everywhere and the simplest macro seems to be the one below but if I go to “utensili-personalizza-eventi” in my list there is no word “content modified” so I can’t get the macro to work
Sub Autodate(e)
dim adjacentCel as Object
ODoc = ThisComponent
OSheet = ODoc.CurrentController.ActiveSheet
dim WatchedColumn as Integer
dim AutoDateColumn as Integer
dim AutoTimeColumn as IntegerWatchedColumn = 7 AutoDateColumn = -7 AutoTimeColumn = -6 If e.supportsService("com.sun.star.sheet.SheetCell") Then dim adjY as Integer If (e.CellAddress.Column = WatchedColumn) Then adjY = e.CellAddress.Column + AutoDateColumn adjacentCel = OSheet.getCellByPosition(adjY, e.CellAddress.Row) adjacentCel.String = Format(Date(), "d/m/yyyy") adjY = e.CellAddress.Column + AutoTimeColumn adjacentCel = OSheet.getCellByPosition(adjY, e.CellAddress.Row) adjacentCel.String = Format(Time(), "h:mm:ss") End If End If
End Sub
Can someone help me?
Thank you very much everyone!
P.S.
I have a rather old version of Libreoffice, namely 7.5.9.2 but I can’t update it.