Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hide and Unhide Rows button
I have this code for a button to hide and Unhide rows (7 to 10) But it
hides everything in my sheet. I just want it to hide just the 4 rows. Private Sub CommandButton8_Click() If CommandButton8.Caption = "Hide" Then Range("7:7,8:8,9:9,10:10").Select Selection.EntireRow.Hidden = True CommandButton8.Caption = "UnHide" Else Range("7:7,8:8,9:9,10:10").Select Selection.EntireRow.Hidden = False CommandButton8.Caption = "Hide" End If End Sub Thanks in advance, Cheers John |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hide and Unhide Rows button
Try this:
Private Sub CommandButton8_Click() If CommandButton8.Caption = "Hide" Then Rows("7:10").hidden=true CommandButton8.Caption = "UnHide" Else Rows("7:10").hidden=false CommandButton8.Caption = "Hide" End If End Sub "FinlandGuy" wrote: I have this code for a button to hide and Unhide rows (7 to 10) But it hides everything in my sheet. I just want it to hide just the 4 rows. Private Sub CommandButton8_Click() If CommandButton8.Caption = "Hide" Then Range("7:7,8:8,9:9,10:10").Select Selection.EntireRow.Hidden = True CommandButton8.Caption = "UnHide" Else Range("7:7,8:8,9:9,10:10").Select Selection.EntireRow.Hidden = False CommandButton8.Caption = "Hide" End If End Sub Thanks in advance, Cheers John |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hide and Unhide Rows button
Try this:
Private Sub CommandButton8_Click() If CommandButton8.Caption = "Hide" Then Range("7:10").EntireRow.Hidden = True CommandButton8.Caption = "UnHide" Else Range("7:10").EntireRow.Hidden = False CommandButton8.Caption = "Hide" End If End Sub Regards, Stefi €žFinlandGuy€ť ezt Ă*rta: I have this code for a button to hide and Unhide rows (7 to 10) But it hides everything in my sheet. I just want it to hide just the 4 rows. Private Sub CommandButton8_Click() If CommandButton8.Caption = "Hide" Then Range("7:7,8:8,9:9,10:10").Select Selection.EntireRow.Hidden = True CommandButton8.Caption = "UnHide" Else Range("7:7,8:8,9:9,10:10").Select Selection.EntireRow.Hidden = False CommandButton8.Caption = "Hide" End If End Sub Thanks in advance, Cheers John |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hide and Unhide Rows button
Hi John, it works fine for me. you can shorten your code with excel 2003
Private Sub CommandButton8_Click() If CommandButton8.Caption = "Hide" Then Range("7:10").EntireRow.Hidden = True CommandButton8.Caption = "UnHide" Else Range("7:10").EntireRow.Hidden = False CommandButton8.Caption = "Hide" End If End Sub Best regards, Les Stout *** Sent via Developersdex http://www.developersdex.com *** |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hide and Unhide Rows button
I dont think you displayed your hole message. Please try again. thanks
BR, John |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hide and Unhide Rows button
Awesom thanks a bunch
Cheers, John |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hide and Unhide Rows button
You are welcome! Thanks for the feedback!
Stefi €žFinlandGuy€ť ezt Ă*rta: Awesom thanks a bunch Cheers, John |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Enabling option „Format rows“ to hide/unhide rows using VBA-code? | Excel Discussion (Misc queries) | |||
hide or unhide rows with button | Excel Discussion (Misc queries) | |||
Code for button to hide/unhide rows | Excel Worksheet Functions | |||
Command Button to Hide/Unhide Rows | Excel Discussion (Misc queries) | |||
create button that can hide/unhide sheets and hyperlink... | Excel Programming |