Hi, I am still starting with macros and I am curious if someone can help me with this. I found a basic macro on the internet that I have adjusted and it works in calc as soon as I start it manually. But not when I choose something in the selection list in cell B89, And the second thing is that it is not variable. With this macro I have to create a new macro for each tab.
--------------------Makro:-----------------------------------------
Sub change_value(cell)
If cell.AbsoluteName = "$WBS-1.$B$89" Then
Select Case cell. String
Case "Persoonlijk": Persoonlijk
Case "Gezamelijke": Gezamelijke
Case "Beide": Beide
End Select
End If
End Sub
Sub Persoonlijk()
doc = ThisComponent
sheet = doc.CurrentController.ActiveSheet
range = sheet.getCellRangeByName("A90:A100")
range.Rows.isVisible = False
range = sheet.getCellRangeByName("A101:A110")
range.Rows.isVisible = True
End sub
Sub Gezamelijke()
doc = ThisComponent
sheet = doc.CurrentController.ActiveSheet
range = sheet.getCellRangeByName("A90:A100")
range.Rows.isVisible = True
range = sheet.getCellRangeByName("A101:A110")
range.Rows.isVisible = False
End sub
sub Beide()
doc = ThisComponent
sheet = doc.CurrentController.ActiveSheet
range = sheet.getCellRangeByName("A90:A100")
range.Rows.isVisible = True
range = sheet.getCellRangeByName("A101:A110")
range.Rows.isVisible = True
End sub
Is there any way to
If cell.AbsoluteName = "$WBS-1.$B$89"
replace it with
doc = ThisComponent
sheet = doc.CurrentController.ActiveSheet
I work with calc version:
Version: 24.2.0.3 (x86) / LibreOffice Community
Build ID: da48488a73ddd66ea24cf16bbc4f7b9c08e9bea1
CPU threads: 4; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win
Locale: nl-NL (nl_NL); UI: nl-NL
Calc: CL threaded
Thanks in advance for the help.