PDA

View Full Version : Solved: Hidding button on worksheet depending on password



Mr_Mod
09-15-2011, 03:48 AM
Hi,
is it possible to have a login screen where a user does not need to enter a password and this will hide a button on the worksheet. Whilst when a user enter a password the button is visible and active.

I want to allow and admin person to be able to transfer data between the master workbook and the one field staff use but prevent the data person from accessing it as this would cause a macro to run.
The data entry person is out in the field and will not have any access to the master workbook which will be in the office.

I know how to create forms but lost when it comes to the rest of what needs to be done.

Help appreciated

Bob Phillips
09-15-2011, 03:57 AM
Yes. Which bit do you need help with?

Mr_Mod
09-15-2011, 05:39 AM
This is what i wrote for the code on the user form for password entry.
Sub CommandButton1_Click()

Dim WB As Workbook
Set WB = Workbooks("book1")
If TextBox1.Text = "password" Then button1.true 'button 1 located in workbook 1, sheet 1
Else: button1.false
End If
End Sub

The worksheet would be "sheet1" where the button i want to hide is placed in work book 1

Initially when the workbook is open the button would be hidden.

This is what i have written for the workbook when it is opens
Private Sub Workbook_Open()

Sheets("Sheet1").button1.false
UserForm1.Show
End Sub

Just doesnt seem to work, and i cant figure it out

Bob Phillips
09-15-2011, 05:54 AM
Use



Worksheets("Sheet1").Buttons("Button 1").Visible = True/False

Mr_Mod
09-15-2011, 04:04 PM
Many thanks fo you help