+ Reply to Thread
Results 1 to 4 of 4

Userform values based on values from Worksheet

  1. #1
    Forum Contributor
    Join Date
    09-02-2013
    Location
    London
    MS-Off Ver
    Excel 2019
    Posts
    368

    Userform values based on values from Worksheet

    Hello everyone,

    Please find attached a workbook with a userform. The purpose of the userform is to capture value automatically based on values from worksheet 'Payment'.

    The payment sheet will record every payment made from a corresponding 'Entry Nr'. The 'Payment Nr' of column A is unique and cannot be duplicated but 'Entry Nr' in column B can be duplicated. Duplication occurs, for payment in instalment, for instance or part-payment.

    What I would like to achieve is that, based on the corresponding 'Entry Nr', I would like the VBA to extract the first payment date, the last payment date, the amount paid in the last payment and the total amount paid for that 'Entry Nr'. Of course, it is logical to assume that the textboxes for the First and Last Payments Date should be equal if there is only ONE payment made. And equally, the textboxes for Last Paid Amount and Total Paid Amount are also equal since there is only ONE payment and no other subsequent payments were made.

    Please see the examples as per the data given.
    As you can see from the example of 'Entry Nr 0002' the Last Payment was not recorded as the last in chain since another earlier payment was recorded last.

    0002.PNG
    0003.PNG

    Unfortunately, I could not think of a code to present as I was thinking how should I go about achieving this and never managed to come up with anything meaningful.

    Your help and direction is much appreciated.
    Thank you very much
    Attached Files Attached Files
    Last edited by rakotonirinas; 10-08-2019 at 09:18 AM.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Userform values based on values from Worksheet

    Hello rakotonirinas,

    To match entries there has to be a field in the database that is unique to each record. From what I see, that number is the Payment Number. Records are pulled that have fields matching the search criteria. Pulling the records by matching the Entry Number does not make sense because this number will not guarantee the returned records are unique.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Forum Contributor
    Join Date
    09-02-2013
    Location
    London
    MS-Off Ver
    Excel 2019
    Posts
    368

    Re: Userform values based on values from Worksheet

    Hello Leith Ross,
    Pulling the records by matching the Entry Number does not make sense because this number will not guarantee the returned records are unique.
    You are exactly correct in your statement. However, the information that will populate the userform is definitely taken from matching the Entry number, which is the string to search in order to populate then the 4 textboxes below it.
    Perhaps, to give a expanded picture of the project. These values will be extracted from that database to the userform with some more other controls (textboxes, comboboxes, etc.) as it will then be transferred on another worksheet with much more data.
    So as you can see, the 2 figures above are examples of what I would like to achieve.
    Not sure whether that makes sense.
    Thank you.

  4. #4
    Forum Contributor
    Join Date
    09-02-2013
    Location
    London
    MS-Off Ver
    Excel 2019
    Posts
    368

    Re: Userform values based on values from Worksheet

    Anyone may be able to help on this?

+ 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. Display values from a second Worksheet in a userform based on Criteria
    By anthony1312002 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-12-2018, 10:02 AM
  2. values from worksheet into userform
    By mubashar in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-02-2014, 01:13 AM
  3. Paste Values from Userform into Worksheet
    By mrmoc85 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-14-2013, 02:47 AM
  4. Replies: 4
    Last Post: 11-28-2012, 06:09 PM
  5. Saving values from a Userform to a variable to use in a worksheet
    By scott0102 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-28-2011, 02:10 AM
  6. Need help searching worksheet for userform textbox values
    By bsweet0us in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-16-2011, 10:57 AM
  7. printing values from worksheet to userform
    By excelkeechak in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-10-2009, 10:31 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