Hi all rarely post on here less im stuck.
I cant get my head round the following problem:
I have a workbook with multiple worksheets. I need the user to only se their respective work sheet & hide all of the others. The only way i know of to do this is using an input box & based on the results of that input...set the workbook accordingly. The problem is How do I set it so that a value must be entered & that if the value = x then do x, if z then do z ??
Heres what Im toying with at current.
___________________________________________
Private Sub Workbook_Open()
Login
End Sub
___________________________________________
Private Sub Login()
Dim Password As String
Do Until Password <> ""
Password = InputBox("Enter your Password: ", "Secure Login")
If Password = "123" Then
Sheet1.Visible = False
Sheet3.Visible = False
Sheet2.Protect DrawingObjects:=False, Contents:=True, Scenarios:= _
False, AllowFormattingCells:=True, AllowFormattingColumns:=True, _
AllowFormattingRows:=True, AllowInsertingColumns:=True, AllowInsertingRows _
:=True, AllowInsertingHyperlinks:=True, AllowDeletingColumns:=True, _
AllowDeletingRows:=True, AllowSorting:=True, AllowFiltering:=True, _
AllowUsingPivotTables:=True
End If
Loop
ActiveWorkbook.Protect Structure:=True, Windows:=False
End Sub
___________________________________________
....any help would be gratefully appreciated
I cant get my head round the following problem:
I have a workbook with multiple worksheets. I need the user to only se their respective work sheet & hide all of the others. The only way i know of to do this is using an input box & based on the results of that input...set the workbook accordingly. The problem is How do I set it so that a value must be entered & that if the value = x then do x, if z then do z ??
Heres what Im toying with at current.
___________________________________________
Private Sub Workbook_Open()
Login
End Sub
___________________________________________
Private Sub Login()
Dim Password As String
Do Until Password <> ""
Password = InputBox("Enter your Password: ", "Secure Login")
If Password = "123" Then
Sheet1.Visible = False
Sheet3.Visible = False
Sheet2.Protect DrawingObjects:=False, Contents:=True, Scenarios:= _
False, AllowFormattingCells:=True, AllowFormattingColumns:=True, _
AllowFormattingRows:=True, AllowInsertingColumns:=True, AllowInsertingRows _
:=True, AllowInsertingHyperlinks:=True, AllowDeletingColumns:=True, _
AllowDeletingRows:=True, AllowSorting:=True, AllowFiltering:=True, _
AllowUsingPivotTables:=True
End If
Loop
ActiveWorkbook.Protect Structure:=True, Windows:=False
End Sub
___________________________________________
....any help would be gratefully appreciated