+ Reply to Thread
Results 1 to 3 of 3

Multi-level Userform login Issues - Cells not remaining protected.

Hybrid View

  1. #1
    Registered User
    Join Date
    02-13-2014
    Location
    Columbus, OH
    MS-Off Ver
    Excel 2010
    Posts
    19

    Multi-level Userform login Issues - Cells not remaining protected.

    I am currently having some code issues in regards to my multiple passwords I setup. For some reason the "basic level" or when someone opens the spreadsheet is allowing them to actually edit the ranges of "attendees","traveldates", and "location". These cells are only suppose to become editable after using the password "model" or supermodel". Does anyone know why these cells are currently editable when the the workbook opens instead of once the password is entered?

    The first code is run when the commandbutton is pressed and the second code is when the workbook opens. I have included the overall file as well.



       If textpassword.Text = "model" Then
            MsgBox "Managerial Login Successful"
     Sheets("Taxi Fare").Visible = True
     
     Sheet1.Unprotect
     Sheet7.Unprotect
     Worksheets("Attendees").Range("attendees").Locked = False
     Worksheets("Menu Page").Range("traveldates").Locked = False
     Worksheets("Menu Page").Range("location").Locked = False
      Sheet1.Protect
     Sheet7.Protect
     Else
    
     If textpassword.Text = "supermodel" Then
     MsgBox "Full Access Granted"
            Sheet1.Unprotect
                i = 1
                Do Until i > Sheets.Count
                    Set ws = Sheets(i)
                    ws.Visible = xlSheetVisible
                    i = i + 1
                Loop
    
        Sheet1.Unprotect
        Sheet7.Unprotect
        Sheet3.Unprotect
        Sheet5.Unprotect
        Sheet9.Unprotect
        Sheet17.Unprotect
        Sheet13.Unprotect
        Sheet18.Unprotect
    
        Unload Me
                Unload Me
            Else
                MsgBox "The passowrd entered is incorrect.", vbCritical, "Incorrect Password"
    
            End If
            End If
            
     Unload Me
    End Sub
    Private Sub Workbook_Open()
    For Each ws In ActiveWorkbook.Worksheets
     If ws.Name = "Airline Raw Data" _
     Or ws.Name = "Hotel Raw Data" _
     Or ws.Name = "Transportation Raw" _
     Or ws.Name = "Employee Data" _
     Or ws.Name = "WeatherDatabase" _
     Or ws.Name = "Per Diem" _
     Or ws.Name = "Transportation" _
     Or ws.Name = "Currency Calculator" _
     Or ws.Name = "Update Log" _
     Or ws.Name = "Random Inputs" _
     Or ws.Name = "Other Cities" _
     Or ws.Name = "Taxi Fare" Then
     ws.Visible = xlSheetVeryHidden
     End If
     Next ws
        
    Worksheets("Currency Calculator").Activate
    
    
    Selection.QueryTable.Refresh BackgroundQuery:=False
    Worksheets("Menu Page").Activate
    
        With Sheets("Employee Data")
            .Range(("A2"), .Range("A2").End(xlDown)).Name = "Employee_ID"
        End With
        
        Sheet1.Protect
        Sheet7.Protect
        Sheet3.Protect
        Sheet5.Protect
        Sheet9.Protect
        Sheet17.Protect
        Sheet13.Protect
        Sheet18.Protect
        
        
    End Sub

    Hong Kong 730PM.xlsm

  2. #2
    Registered User
    Join Date
    02-13-2014
    Location
    Columbus, OH
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: Multi-level Userform login Issues - Cells not remaining protected.

    Does anyone have any suggestions as to why these cells are unlocked before the password is entered?
    Last edited by Chardo; 02-18-2014 at 10:11 AM.

  3. #3
    Registered User
    Join Date
    02-13-2014
    Location
    Columbus, OH
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: Multi-level Userform login Issues - Cells not remaining protected

    Any help is greatly appreciated. I need to solve this issue in the next few hours if possible!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Bill of Materials conversion from multi level to single level
    By susmitpatel in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 07-11-2013, 12:53 AM
  2. Protected Cells Issues
    By Seattle_Mike in forum Excel General
    Replies: 1
    Last Post: 08-20-2009, 08:58 PM
  3. multi-column listbox on userform, multiple issues
    By KR in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-15-2006, 04:00 PM
  4. Using macro to convert single level BOM to Multi Level BOM
    By andrew_chong in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-07-2006, 04:57 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1