Hiding and Unhiding columns in Excel

Hi All

Trying to write a simple macro on excel and attach this code to a button. This is whats happened so far:

got a workbook with 2 sheets (menu & new rec)

menu has all my custom buttons

there are 12 buttons

each button should skip to new rec sheet, unhide all the columns and hide all but the column specified. In new rec sheet there are 12 periods and each button represents a period. There is also a total column which is constant and should never be hidden

How do i get each button to only shown the corresponding period in the new rec sheet?

Here is my macro written so far but it has and error in the range

Many Thanks in advance!

Private Sub CommandButton22_Click()
Sheets("New Rec").Select
Selection.EntireColumn.Hidden = False
Selection.EntireColumn.Hidden = True
Selection.EntireColumn.Hidden = True
End Sub
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!