+ Reply to Thread
Results 1 to 11 of 11

Userform inputs comparison with sheet cells and if true reset userform fields

  1. #1
    Registered User
    Join Date
    07-27-2017
    Location
    UK
    MS-Off Ver
    2012
    Posts
    43

    Userform inputs comparison with sheet cells and if true reset userform fields

    Hi all,

    I have a spread sheet where Sheet1 contains 5 header columns; PO, PO Line, Total Hours, Hours Booked and Remaining Hours. The data for the first 3 is entered manually, the Hours Booked comes from a Userform1 inputs and Hours Remaining is a simple calc.

    The Userform1 selects PO and PO Line via comboboxes (linked to Sheet1) and inputs Hours Booked via textbox and appends these details to Sheet1, therefore updating the calculations for Hours Remaining.

    When entering the data on Userform1, I'd like it to reset or blank the PO and PO Line fields (plus throw a warning message on screen) if the Hours Remaining on Sheet1 minus the Hours Booked on the Userform1 for that PO and PO Line would result in a value less than zero. I.e. it won't submit the data.

    Hope that makes sense.

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Userform inputs comparison with sheet cells and if true reset userform fields

    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.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    07-27-2017
    Location
    UK
    MS-Off Ver
    2012
    Posts
    43

    Re: Userform inputs comparison with sheet cells and if true reset userform fields

    Ok sanitised workbook attached.

    The Menu tab has the userform with the inputs which are written to the Data tab. The Part4 tab then interrogates the data tab and will prevent further bookings to PO / PO Lines if it would cause Part 4 Column E to go negative, so I'd like to reset or blank the userform PO number and PO line number fields hence preventing overbooking of those and show a message as such.

    Thanks
    Attached Files Attached Files

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Userform inputs comparison with sheet cells and if true reset userform fields

    I have an older (2003) version of Excel and it has issues opening your workbook. Perhaps someone else will help.

  5. #5
    Registered User
    Join Date
    07-27-2017
    Location
    UK
    MS-Off Ver
    2012
    Posts
    43

    Re: Userform inputs comparison with sheet cells and if true reset userform fields

    Ok I could save in 2003 and post here?

  6. #6
    Registered User
    Join Date
    07-27-2017
    Location
    UK
    MS-Off Ver
    2012
    Posts
    43

    Re: Userform inputs comparison with sheet cells and if true reset userform fields

    Ok thanks anyway, is anyone else able to help with this please?

  7. #7
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: Userform inputs comparison with sheet cells and if true reset userform fields

    Try

    Please Login or Register  to view this content.
    Kind regards
    Leo

  8. #8
    Registered User
    Join Date
    07-27-2017
    Location
    UK
    MS-Off Ver
    2012
    Posts
    43

    Re: Userform inputs comparison with sheet cells and if true reset userform fields

    Great thanks works well, though I've also plugged this into my own spread sheet and it gets caught up at:

    Please Login or Register  to view this content.
    My data in part4 is at columns C and D for the PO and PO Line references and N and O for the used and remaining hour (with headers at row 6).
    Last edited by aidan5800; 08-02-2018 at 09:10 AM.

  9. #9
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: Userform inputs comparison with sheet cells and if true reset userform fields

    few modifications marked in red

    Please Login or Register  to view this content.
    Kind regards
    Leo

  10. #10
    Registered User
    Join Date
    07-27-2017
    Location
    UK
    MS-Off Ver
    2012
    Posts
    43

    Re: Userform inputs comparison with sheet cells and if true reset userform fields

    That's great thankyou!!

  11. #11
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: Userform inputs comparison with sheet cells and if true reset userform fields

    no thanks,

    if you have no more questions, please mark the case as solved

    Kind regards
    Leo

+ 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. Saving inputs on userform
    By Gumit in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-15-2017, 04:54 AM
  2. [SOLVED] Msgbox from Userform - how to return to Userform and retain the inputs
    By nickersonpower in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-05-2017, 12:14 PM
  3. Trying to get new inputs from Userform into New/Unused Columns
    By don_zalot in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-20-2017, 03:45 PM
  4. [SOLVED] Show sheet when userform is shown hide Sheet when userform is closed
    By CtrlAltDelete in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-25-2014, 04:41 PM
  5. Replies: 1
    Last Post: 09-05-2012, 04:11 PM
  6. Reset Dropdown Lists based on Other inputs / cells
    By jonreynolds in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 08-12-2009, 12:20 PM
  7. Help selecting a range in vba from userform inputs
    By grievesy in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-27-2006, 05:35 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