Back Button in excel

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • squidge1990
    New Member
    • Nov 2006
    • 9

    #1

    Back Button in excel

    when a user logs in it will store there security level in a public variable called level. im trying to use this so that i can create a back button to instead of going back the login screen it will go back to the users switchboard. but the code doesnt seem to be reading from the variable.
    heres the code of the back

    Private Sub back_Click()
    If level = low Then
    Worksheets("Low lev").Visible = True
    Worksheets("Low lev").Select
    End If
    If level = Mid Then
    Worksheets("Mid Level").Visible = True
    Worksheets("Mid Level").Select
    End If
    If level = high Then
    Worksheets("Hig hLevel").Visibl e = True
    Worksheets("Hig hLevel").Select
    End If
    Exit Sub
    End Sub

    i would be very thankful for anyones help
  • albertw
    Contributor
    • Oct 2006
    • 267

    #2
    i would be very thankful for anyones help[/QUOTE]

    hi
    i should do this differently use Case instead

    Private Sub back_Click()
    Select Case Level
    Case is = low
    Worksheets("Low lev").Visible = True
    Worksheets("Low lev").Select
    Case is = medium
    Worksheets("Med iumlev").Visibl e = True
    Worksheets("Med iumlev").Select
    Case is= high
    Worksheets("Hig hlev").Visible = True
    Worksheets("Hig hlev").Select
    End Select
    End Sub

    declare the variables Level, Low, Medium and High in your general declaration if you want them to be available in your form, or in a module if you want them in the entire project.

    Comment

    Working...