Howdy, Stranger!

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

Categories

Hiding and Unhiding columns in Excel

whizzkidnotwhizzkidnot Member Posts: 2
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
Range("A5:R5").Select
Selection.EntireColumn.Hidden = False
Columns("B:B").Select
Selection.EntireColumn.Hidden = True
Range("E5:O5").Select
Selection.EntireColumn.Hidden = True
Range("A5").Select
End Sub
Sign In or Register to comment.