Results 1 to 3 of 3

VBA Login code (userform)

Threaded View

  1. #1
    Registered User
    Join Date
    10-12-2014
    Location
    Singapore
    MS-Off Ver
    2013
    Posts
    2

    VBA Login code (userform)

    This is the codes i'm using for the user form i've created:

    Option Explicit Private Sub Login_Click() Dim user As Variant user = LoginPage.UserName.Value Dim pw As Variant pw = LoginPage.UserName.Value Dim try As Integer try = 0 Dim formula As String formula = "C" & WorksheetFunction.Match(user, Sheet2.Range(Cells(9, 2), Cells(18, 2)), 0) Dim successlogin As String successlogin = "Welcome back " & user & "! Your login will be recorded down." If try < 4 Then If WorksheetFunction.CountIf(WorksheetFunction.Indirect(Sheet2.Range(Cells(9, 2), Cells(18, 2))), pw) = 1 Then MsgBox (successlogin) Unload Me Else MsgBox ("Either your username or password is incorrect, please try again.") try = try + 1 End If Else MsgBox ("You have failed to enter the correct login key within 3 attempts. The file will now be closed.") Unload Me End If End Sub
    What i'm trying to do can be separated into different phase:

    Phase 1: Code the userform so that the UserName and password inputted can be matched with those in data pool and if it's matched, Login successful, or else, failed.

    Phase 2: Code to record down all the successful login into Sheet 2.

    Phase 3: Disable the [exit "x"] button of the login userform.


    PLEASE~~!!! ANYONE?! PLEASE HELP ME!!
    Attached Files Attached Files
    Last edited by alansidman; 10-16-2014 at 01:10 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Username/Password Login userform code
    By Nitefox in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-17-2014, 02:43 PM
  2. How to create a password login through a userform
    By xia0jj in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 01-10-2014, 05:59 AM
  3. Skip Login window in browser userform
    By zbor in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 04-16-2012, 02:51 AM
  4. Userform Login
    By clint182 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-28-2011, 01:55 PM
  5. Login Logout userform
    By poitachi in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-19-2010, 03:01 PM

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