Hide and show Columns with Buttons

Hello there,
I hope to find some help from you all for this little task.

I am trying to hide and show columns with buttons.
I guess I need makros for that.

The buttons should be doing this:

Button 1:

  • Show all columns

  • Write in A1: “Show All”

Button 2:

  • Show all columns but hide column B
  • Write in A1: “Hide B”

Button 3:

  • Show all columns but hide column C
  • Write in A1: “Hide C”

So far I was not able to put this into practice even though it seems simple…

Thank you for your help!

Baruch

What about Group?

In an Answer @Baruch_Ben_Chessed had written this comment: (Answer deleted)

Thank you! That is not yet the full solution I was hoping for, but it’s definitely a nice feature that speeds up the workflow a little bit.

That is not yet the full solution I was hoping for

@Baruch_Ben_Chessed: That’s why I didn’t write an answer, but a comment.

I see, thank you. (Sorry, I’m new here.)

Don’t understand the “Write in A1”. Do you actually want to edit cell A1 of a specific sheet? Why?
If column B is hidden, but A1 visible, It shouldn’t be difficult for the user to see that column B is hidden. In fact he(f/m) wil see the first not hidden column right of A.
Then: Why buttons? A single toolbar icon can easily trigger 3 or 4 related actions depending on the pressed modifier key(s).

Hello,

take a look a the following sample file: Q303137-HideShowColumns.ods

which implements

  • Macros to hide / show the columns (See Tools -> Macros -> Organize Macros -> Basic...)
  • A customized toolbar User which contains three “Buttons” called
    [1] Show All
    [2] Hide B
    [3] Hide C
    (see Tools -> Customize -> Tab: Toolbar -> Category: Macros / Scope: Q303137-HideShowColumns.ods / Target: User

Note(s):

  • If you need this to be available on all of your documents change Scope from Q303137-HideShowColumns.odsto LibreOffice Calc and copy macros to My Macros
  • You may assign the macros to any other toolbar at your own discretion
  • I did not put any effort in error handling
  • I did not put any effort in creating proper icons for the “Buttons”

Macros tested using LibreOffice:

Version: 7.1.2.2 / LibreOffice Community
Build ID: 8a45595d069ef5570103caea1b71cc9d82b2aae4
CPU threads: 8; OS: Linux 5.3; UI render: default; VCL: kf5
Locale: en-US (en_US.UTF-8); UI: en-US, Calc: threaded

Hope that helps.

Thank you so much Opaque for your efforts!
It works perfectly for me and I was able to adjust it all to my specific needs.
Great job!