Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
option button to hide rows, with password
Dear Experts,
I would like to provide an option button to enable users to hide preselected rows (25 to 128) in a worksheet. Click on the button, the rows are hidden, unclick the button the rows reappear. I have tried the following code in the Sheet 5 (Code) window of the VB screen: Private Sub OptionButton1_Click() If OptionButton1.Value = True Then Row("25:128").Select Selection.EntireRow.Hidden = True Else Row("25:128").Select Selection.EntireRow.Hidden = False End If End Sub This code works to hide the rows, but the rows do not reappear (possibly because the option button doesn't respond to the second click to clear the button). I would appreciate any help please. As an unexpected bonus, it would be excellent if the main user could be asked for a user-specified password after clicking the option button to hide the rows so the hidden rows are protected from viewing by others who access the file. Then, when the main user wants to view the hidden rows, clicking on the option button to clear the button would prompt the main user for his password, after which the rows would unhide. If code can't do this, then I will direct the user to click on Tools, Protection, Protect Sheet to password protect the sheet after hiding the rows. Thank you for your expertise and assistance. |
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) | |||
option button (yes No) to hide rows | 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) |