Auto locking macro help

so i am trying to get the macro to auto lock cells after data entry, and auto same the workbook every 10 seconds.

this is what i have so far.

to auto lock cells:

Private Sub Worksheet_Change(ByVal Target As Range)
ActiveSheet.Unprotect Password:=“1234”
Target.Locked = True
ActiveSheet.Protect Password:=“1234”
End Sub

and my auto save:

Private Sub Workbook_Open()
Application.OnTime Now + TimeValue(“00:00:10”), “SaveThis”
End Sub

my module:

Sub SaveThis()

Application.DisplayAlerts = False
ThisWorkbook.Save
Application.DisplayAlerts = True

Application.OnTime Now + TimeValue(“00:00:10”), “SaveThis”

End Sub

what issue im running into with libre is “Target.Locked = True” and “ThisWorkbook.Save” is there a LibreOffice way to use these commands?

First of all, you are welcome!

Let’s agree on terms: when you say “Workbook” you mean Excel, if you are talking about Calc you call the document a “spreadsheet”. Yes, Calc knows how to work with “Workbook”, but it does it a little worse than with a “spreadsheet”. So which document are you going to edit?

Why save a document so often? If this happens once a minute, won’t it be enough? The fact is that if the document becomes large enough, and besides Calc, several tasks will be performed in parallel, then the time it takes to save the document to disk may take several seconds, for example 9. And then the user will have one second out of ten to edit the data - this will not be work, but torment, isn’t it?

If you agree to save the document no more than once a minute, then I have good news for you - you do not need a macro for this task. “Autosave” is a built-in LibreOffice feature, just tweak it the way you want it.

Protecting a cell with data is also a task that can be solved without a macro. Spreadsheets are designed so that by applying different cell styles, you can control not only the appearance of the table, but also its behavior.

Therefore, you can specify “Protected” in the properties of ALL cells, enter some kind of “Enter a value” prompt in the cells for data entry and create conditional formatting that will apply a style in which protection is disabled to cells with this phrase.

i am setting up work stations that i want an electric logging file, my goal is to make it so once information is placed into a cell, it can not be edited, as for the 10 second save, that time does not need to be 10 seconds. but that is my goal, and on excel this worked very well, but my company wants to utilize linux for the floor workers.

on excel the save every 10 seconds you never notice it or see it happening. but you have a good point on when the file grows in size. i havent actually utilized this set up yet, so the 10 seconds is definitely changeable.

OMG! Do you want to use a spreadsheet for this task? Sorry, but this is … mmmm … wasteful. A log file is traditionally a text file into which data with a date-time stamp are added line by line. It is very fast, almost instantaneous. There are many ways to do this without using LibreOffice. And you can already view and analyze the log file in a spreadsheet or in another special program.

okay, so what would you recommend to use? the only reason I chose to go with a spread sheet was because of the ability to make it so that after data entry it could not be redacted. we have had people go back and redact logs when things were fixed to make it look as though the issue wasn’t apparent. so what text file would allow for data entry to not be redacted after its entry?

this would be a huge help and benefit for me. i am definitely aware that a spreadsheet isnt the best option for this, but was able to correct the issue we had.

Perhaps one of the experts present here will suggest a short and simple way using the built-in capabilities of the operating system (read-write permissions) - I don’t know Linux that well. But in order to receive detailed instructions, you will have to supplement your question: tell us about which operating system you are talking about, what kind of data you need to save.

The more details, the more likely you are to get comprehensive recommendations (although this question would probably be better asked in the Linux user community)