PDA

View Full Version : How to Hide Specified Cells?



ACM
12-07-2010, 02:31 PM
Is there a way of hiding just the cells you highlight rather than hiding the whole row/column?

As you can see with my soccer spreadsheet, I'd like to be able to have it so whenever the user clicks on one of the 'Show/Hide' buttons at the bottom, it hides the respective home or away table. Currently, I can only seem to hide the whole columns belonging to the home or away sections.

Also, what code do I use to make the home/away section reappear? I used a recorded macro to hide it but how can I use the same button to hide it? This is what I have so far for the home section:

Sub showorhidehometable()
' hidehometable Macro
Columns("F:M").Select
Range("F2").Activate
Selection.EntireColumn.Hidden = True
End Sub

There's an image below to help you understand what I'm on about:

img80.imageshack.us/img80/81/38791923.png

Bob Phillips
12-07-2010, 02:50 PM
You can only unhide whole columns/rows.

You can toggle it so



With Columns("B")

.Hidden = Not .Hidden
End With

ACM
12-07-2010, 03:43 PM
You can only unhide whole columns/rows.

You can toggle it so



With Columns("B")

.Hidden = Not .Hidden
End With
Thank you. Is there a way of keeping the buttons within those columns, but when the section is hidden by clicking on the button, they stay in the same place?

Currently when the button is clicked on, the section disappears but the button does as well. The only way to resolve this it seems is to place the button outside of those columns.

Bob Phillips
12-08-2010, 12:57 AM
Set the property of the button to not move with the cells .