How can I display selected worksheet areas with command buttons?

Nikko

Board Regular
Joined
Nov 26, 2018
Messages
73
Hello,

Would like to have worksheet sections displayed by command buttons, but I do not know how to do it.

In the worksheet the month range should be displayed by clicking on the respective button.
So that the respective desired month after column G appears (column A to G should always be displayed with). Example Column from A to G fixed and after column G the respective beginning of the month should appear as column AM for February. The whole area should not be selected at the end.

07f43e-1547746169.jpg
[/URL][/IMG]

Thx in Advance :)
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Hi jim,
Thank you for your suggestion.
But this is not what I am looking for or need. Would like to accomplish all this with VBA and Command Buttons (see picture).
Need actual support for the VBA code, as I can write and install this in a command button.

Any idea how to do it?
 
Upvote 0
Here is the Code behind your January Button (Only). You can create the Same MODIFIED- CODE for the Feb - Dec Buttons (the other 11)

Code:
Private Sub CommandButton1_Click() ' To Show ONLY your Janaury Columns
Application.ScreenUpdating = False
With ActiveSheet
    .Range("H:NH").EntireColumn.Hidden = False  'Always Unhides All your Columns from your previous action
    .Range("AM:NH").EntireColumn.Hidden = True   ' Displays the month of January ONLY
End With
Application.ScreenUpdating = True
End Sub

*** COLUMN LETTERS ***
StartEnd
JanHAL
FebAMBN
MarBOCS
Apr????
May????
Jun????
Jly????
Aug????
Sep????
Oct????
Nov????
Dec??NH

<tbody>
</tbody>
 
Last edited:
Upvote 0
Here's the Code that should be BEHIND the February Button...

Code:
Private Sub CommandButton2_Click()     ' Show ONLY February
Application.ScreenUpdating = False
With ActiveSheet
    .Range("H:NH").EntireColumn.Hidden = False  'Always Unhides All your Columns
    .Range("H:AL,BO:NH").EntireColumn.Hidden = True
End With
Application.ScreenUpdating = True
End Sub
 
Upvote 0
Hi jim may,

big thank you for your effort.
Will try it tomorrow and let you know how it went.

Thanks again for your effort and patience with me :)
 
Upvote 0
Hi jim may,

its works :)

Can not thank enough :)

A hero is one who does what he can. The others do not do it. (Romain Rolland)
 
Upvote 0

Forum statistics

Threads
1,215,065
Messages
6,122,944
Members
449,095
Latest member
nmaske

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top