ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   hide row + buttons and password protect (https://www.excelbanter.com/excel-programming/395251-hide-row-buttons-password-protect.html)

bernd

hide row + buttons and password protect
 
Hello,

I'v a sheet with several rows and on those rows action buttons (which
I created with the control toolbar).

When opening my excel file I want several rows in the sheet and the
actions buttons on those rows to be hidden. To unhide them another
bottun must be clicked and the user must be prompted for a password.

My code is like below, the problem is that the buttons won't hide.

Sub hide_selection()
Range("9:9,11:11").Select
Selection.EntireRow.Hidden = True
End Sub

Sub unhide_selection()
pwd = "password"
i_pwd = InputBox("password please")
Select Case i_pwd
Case pwd
Range("9:9,11:11").Select
Selection.EntireRow.Hidden = False
Case Else
MsgBox "incorrect"
End Select
End Sub

Anyone a solution?

Bernd


Dave Peterson

hide row + buttons and password protect
 
Rightclick on each button
choose Format control
On the properties tab, choose move and size with cells.

bernd wrote:

Hello,

I'v a sheet with several rows and on those rows action buttons (which
I created with the control toolbar).

When opening my excel file I want several rows in the sheet and the
actions buttons on those rows to be hidden. To unhide them another
bottun must be clicked and the user must be prompted for a password.

My code is like below, the problem is that the buttons won't hide.

Sub hide_selection()
Range("9:9,11:11").Select
Selection.EntireRow.Hidden = True
End Sub

Sub unhide_selection()
pwd = "password"
i_pwd = InputBox("password please")
Select Case i_pwd
Case pwd
Range("9:9,11:11").Select
Selection.EntireRow.Hidden = False
Case Else
MsgBox "incorrect"
End Select
End Sub

Anyone a solution?

Bernd


--

Dave Peterson

bernd

hide row + buttons and password protect
 
thanks, exactly the information I needed!



All times are GMT +1. The time now is 07:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com