Hey.
Using LibreOffice 7.3.7.2 on Kubuntu 22.04 LTS.
I unfortunately am still using windows office on my work laptop, though luckily, I’m moving to Linux there soon. Here’s the thing though, I have a few spreadsheets that have way too many sheets in them, so I found some instructions online to create a macro with VBA that hides the sheets listed from the A1 cell down in the sheet that carries this code:
Option Explicit
Option Compare TextPrivate Sub Worksheet_Activate()
** Dim R As Range**
** Dim S As String**
** S = Me.Name**
** On Error Resume Next**
** For Each R In Range(“A1”).CurrentRegion**
** Sheets(R.Value).Visible = Left(S, 4) = “Show”**
** Next**
** Mid(S, 1, 4) = IIf(Left(S, 4) = “Show”, “Hide”, “Show”)**
** Me.Name = S**
End SubPrivate Sub Worksheet_SelectionChange(ByVal Target As Range)
** Worksheet_Activate**
End Sub
It works like a charm. This macro itself even works on Libre as well, but only until I save the file. After that, opening the file on windows office, I can see the code is gone. I’m not super well-versed in Libre, though I really like it, but how can I fix this? Yes, I can fix this by opening on windows and re-pasting the code inside, but that’s wonky and I am hoping to ditch windows for good soon. Help greatly appreciated.