+ Reply to Thread
Results 1 to 4 of 4

For Next Loop - If Then

  1. #1
    Forum Contributor
    Join Date
    10-24-2012
    Location
    Chicago
    MS-Off Ver
    O365
    Posts
    311

    For Next Loop - If Then

    Hello,

    I am looking for vba code that uses For Next Loop with If Then in between that tests a username and password login in excel and tests to see if the combination is valid. If not it fails it if so it is successful. If any combination is in error it should fail it. The code is broken up because I started using a form to create it which was working however the requirement is to use For, Next, Loop with If Then to test the login credentials against a table within the workbook. This is the code.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,220

    Re: For Next Loop - If Then

    I don't know if I didn't understand something?
    Use with UserForm.
    Please Login or Register  to view this content.
    Artik

  3. #3
    Forum Contributor
    Join Date
    10-24-2012
    Location
    Chicago
    MS-Off Ver
    O365
    Posts
    311

    Re: For Next Loop - If Then

    I had it working with my original code using the form. See below. I need to do it without the form below and use For Next Loop with If Then's in the code where it shows for every row it checks the username and password using If Then. Then at the end it shows Next i for the next row.

    Please Login or Register  to view this content.

  4. #4
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,220

    Re: For Next Loop - If Then

    I still don't fully understand what exactly you want to get, so you have two macros. The first, 99 times you will be asked for your username and password. The second macro will only ask for the password for the user tested in the loop. If you press Cancel at any of the questions, the macro will exit.
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Artik

+ 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. Loop through emails to find Email today, if not found loop Date -1
    By lougs7 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-29-2020, 12:48 PM
  2. Replies: 13
    Last Post: 07-08-2018, 05:22 AM
  3. [SOLVED] (Beginner help) For loop inside do loop that displays information from reference sheet.
    By lediable007 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 06-08-2016, 03:20 PM
  4. [SOLVED] Auto email loop with formatted table data breaking on second loop VBA
    By Who_else in forum Excel General
    Replies: 6
    Last Post: 03-24-2016, 06:22 AM
  5. [SOLVED] VBA to loop within a loop of multiple blocks of data (currentregion) ... Expert needed
    By Jim885 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-20-2016, 08:28 PM
  6. [SOLVED] Copy dynamically changing column and Paste using VBA Loop (Loop within Loop)
    By nixon72 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-12-2013, 12:46 PM
  7. Why did an inner loop variable start overwriting the outer loop range suddenly?
    By 111StepsAhead in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-16-2012, 03:24 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