I currently have macros to hide 10 columns, then one to hide 10 columns and show then next 10 columns, then the another macro to hide 10 cells and show the previous 10 columns. Essentially, I have a budget and 10 columns represent a month, I have macro to move to the next month or previous or hide the current month. The issue is I’ll end up with 36 macros for each sheet, way to much.
Here is a sample macros for a given month.
Sub Hide_November
theRange = ThisComponent.CurrentController.ActiveSheet.getCellRangeByName("DS:EB")
theRange.Columns.IsVisible = False
End Sub
Sub Show_November
theRange = ThisComponent.CurrentController.ActiveSheet.getCellRangeByName("DS:EB")
theRange.Columns.IsVisible = True
End Sub
Sub Hide_November_Show_December
theRange = ThisComponent.CurrentController.ActiveSheet.getCellRangeByName("DS:EB")
theRange.Columns.IsVisible = False
theRange = ThisComponent.CurrentController.ActiveSheet.getCellRangeByName("ED:EM")
theRange.Columns.IsVisible = True
End Sub
Sub Hide_November_Show_October
theRange = ThisComponent.CurrentController.ActiveSheet.getCellRangeByName("DS:EB")
theRange.Columns.IsVisible = False
theRange = ThisComponent.CurrentController.ActiveSheet.getCellRangeByName("DH:DQ")
theRange.Columns.IsVisible = True
End Sub
I trimmed out some stuff, but the general idea. This code works, but not the best way to do it.
It’d be better to use the same macro to show 10, hide 10 etc…
D