Results 1 to 7 of 7

Password Sign On - Help, please!!

Threaded View

  1. #1
    Registered User
    Join Date
    03-20-2013
    Location
    Los Angeles, CA
    MS-Off Ver
    Excel 2010
    Posts
    8

    Password Sign On - Help, please!!

    I am very new to VBA and am stumped! I have an Excel worksheet that I need to have users access by entering a Username and Password. I keep the user names and passwords on another tab in the same file. I am trying to verify that the user name and user password match the list before allowing the user to access the spreadsheet. I am getting "method range of object _global failed" error and I cannot seem to locate the error in my code. Would someone please help? Thank you!


    Sub Login_Click()
        Dim Username As Range
        Dim RowNo As Long
        Dim ws3 As Worksheet
        Dim aCell As Range
        
        On Error GoTo ErrorHandler
    
        If (Range(d4)) = 0 Then
            Range(d4).SetFocus
            MsgBox "Please select your Username"
            Exit Sub
        End If
    
        If (Range(d5)) = 0 Then
            Range(d5).SetFocus
            MsgBox "Password cannot be empty"
            Exit Sub
        End If
    
        Application.ScreenUpdating = False
    
        Set ws3 = Worksheets("Sheet3")
        Username = Range(d4)
    
        Set aCell = ws3.Columns(1).Find(What:=Username, LookIn:=xlValues, _
        LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
        MatchCase:=False, SearchFormat:=False)
    
        '~~> If match found
        If Not aCell Is Nothing Then
            RowNo = aCell.Row
            If Range(d5) = aCell.Offset(, 1) Then
                FrmMenu.Show
            Else
                MsgBox "Unable to match User Name or User Password, Please try again", vbOKOnly
            End If
        Else '<~~ If not found
            MsgBox "Unable to match User Name or User Password, Please try again", vbOKOnly
        End If
        ws3.Visible = xlSheetVeryHidden
    CleanExit:
        Set ws3 = Nothing
        Application.ScreenUpdating = True
        Exit Sub
    ErrorHandler:
        MsgBox Err.Description
        Resume CleanExit
    End Sub
    Last edited by alansidman; 11-25-2013 at 07:04 PM. Reason: code tags

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 3
    Last Post: 03-13-2013, 01:20 AM
  2. Decimal Sign Replaced with ; Sign
    By lopiner in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-10-2009, 08:47 AM
  3. Macro - asked username & password and sign into Yahoo Finance
    By cbnowhere in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-02-2006, 04:50 PM
  4. [SOLVED] XL invoice replace the dollar sign with euro sign
    By Pamela casares in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 12-16-2005, 04:25 PM
  5. -ve no with -1; positive with sign+ and 0 no sign? Tks.
    By shirley in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-23-2005, 02:20 AM

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