+ Reply to Thread
Results 1 to 5 of 5

Cannot get Nested ifs for a search after msgbox yes answer to work

  1. #1
    Registered User
    Join Date
    08-04-2010
    Location
    United States
    MS-Off Ver
    Office 365 for windows
    Posts
    62

    Cannot get Nested ifs for a search after msgbox yes answer to work

    The intended use or desired result is that this code will prevent duplicate employee logins.

    The Date is in column A, names are in column B, time in is in Column C and time out is in Column D.

    I tried to make it search from bottom to top in Column B for the employee name value chosen in a combo box on a form.

    When a match is found, Column C and D in that row should be checked and if they both have values.

    I guess its assumed if both do, then we are looking at a completed punch. so we should select the last cell in the range, B436, and search up for the last date a punch was made in column A and select the row underneath it and punch in by placing mystr in column A, CboEmployeeName.Value in Column B and Now() in column C.

    If there is a value in the in the punch in column (column c) when a name match is found in column A, check for a missing out in column D. If the in is present and the out is missing, we just get a dialogue box letting us know we are already punched in and no other code in the Sub is ran.

    I came up with the following but after a while I was not able to keep it all straight in my head, I have a neurological health problem and it effects my concentration. If someone could help me finish this I would be super grateful.

    The broken code is in Private Sub btnPunchIn_Click() in the form code.

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by lOYvEpi6M87nEoIF0ul8; 03-25-2021 at 12:55 AM. Reason: Add Spreadsheet

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,835

    Re: Cannot get Nested ifs for a search after msgbox yes answer to work

    This looks strange...
    Please Login or Register  to view this content.
    Perhaps
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    08-04-2010
    Location
    United States
    MS-Off Ver
    Office 365 for windows
    Posts
    62

    Re: Cannot get Nested ifs for a search after msgbox yes answer to work

    Ah yes true thank you. I did make that correction and a few others I forgot I wrote some outside of excel.
    I've got the following but it just makes punches no matter if a person already punched in.

    Please Login or Register  to view this content.

  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,835

    Re: Cannot get Nested ifs for a search after msgbox yes answer to work

    Sorry, but I need to go out, so someone else could help you.

    I think you will get fast precise answer if you upload a workbook.

    Please attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  5. #5
    Registered User
    Join Date
    08-04-2010
    Location
    United States
    MS-Off Ver
    Office 365 for windows
    Posts
    62

    Re: Cannot get Nested ifs for a search after msgbox yes answer to work

    Thank you. Added.

+ 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. [SOLVED] Msgbox yes/no answer with link to a cell
    By jp16 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-16-2016, 06:40 AM
  2. I have a msgbox and i want a cell color to change based on answer
    By Jenkins27 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-10-2015, 10:25 AM
  3. [SOLVED] MsgBox Nested Ifs
    By thesonofdarwin in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-28-2013, 10:54 PM
  4. msgbox for negative answer and how to determine the number of significant digits
    By bmr8002 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-06-2012, 08:56 PM
  5. Require a SAVE AS when msgbox answer = yes
    By clemsoncooz in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-13-2012, 05:27 PM
  6. Msgbox that will prompt for answer before running code
    By Traymond in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 04-29-2009, 12:17 AM
  7. msgbox answer
    By Duncan in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-12-2005, 11:30 AM

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