+ Reply to Thread
Results 1 to 21 of 21

Populate TextBoxes based on 2 Criteria from worksheet Data

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

    Populate TextBoxes based on 2 Criteria from worksheet Data

    Hello,

    I would like to use a userform to display the overview of a report on a list of fruits.

    Test_EF.PNG

    The worksheet Data list all the reports for each fruit on each Fiscal Year month. The content of each reporting month can only be 0, Done and Chase.

    Through kind helps from here, I have managed to populate the label of every textbox based on the selected Fiscal Year. What I need to do next is to extract the report for a selected FY (criterion 1) and Fruit (criterion 2).

    I'm not sure where to start here because it's not something I can filter for instance.

    You will see from the attached workbook, that if I choose Blueberry (green) for the FY2019 (green), my userform should display the value in each textbox respectively what is highlighted in orange.

    Your help is much appreciated on this.

    Thank you.
    Attached Files Attached Files
    Last edited by rakotonirinas; 07-02-2019 at 07:57 AM.

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

    Re: Populate TextBoxes based on 2 Criteria from worksheet Data

    Anyone may have an idea on this?

  3. #3
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: Populate TextBoxes based on 2 Criteria from worksheet Data

    so if i follow you, you want to input the selected fiscal year (FY) and then select the fruit and have it fill out the months based on the DATA table? is that correct?

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

    Re: Populate TextBoxes based on 2 Criteria from worksheet Data

    Quote Originally Posted by dmcgov View Post
    so if i follow you, you want to input the selected fiscal year (FY) and then select the fruit and have it fill out the months based on the DATA table? is that correct?
    That's indeed correct dmcgov. With my example, textboxes should be populated by the following May 2018: Done, Jun 2018: 0, Jul 2018: Done, ..., Mar 2019: Chase, Apr 2019: Chase.

    Thank you.

  5. #5
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: Populate TextBoxes based on 2 Criteria from worksheet Data

    so put this in the code for your form:

    Please Login or Register  to view this content.
    let me know if this works for you

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

    Re: Populate TextBoxes based on 2 Criteria from worksheet Data

    Thank you dmcgov. I think you are on the right path. However, it only pulls the data from the first 12 columns, which means it doesn't take into consideration the Fiscal Year, as it only pulls the first fiscal year.
    I reckon we have to add another variable to be able to consider other Fiscal Year as well.

  7. #7
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: Populate TextBoxes based on 2 Criteria from worksheet Data

    yah, my bad. i skipped over the other columns. let me see if i can me this work for other dates other than 2018.

  8. #8
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: Populate TextBoxes based on 2 Criteria from worksheet Data

    so i need to ask a question. i see that columns c-j have 2017 but not all months are there. how does this impact your userform?

    nm i figured it out. i'll post shortly.

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

    Re: Populate TextBoxes based on 2 Criteria from worksheet Data

    i see that columns c-j have 2017 but not all months are there
    This is because the Fiscal Year or Financial Year starts from May to April. in the drop down list I added the 2017 (which I deleted now) because my data starts only from the May 2017 which is FY18. Hope it makes sense.
    Attached Files Attached Files

  10. #10
    Valued Forum Contributor
    Join Date
    07-14-2017
    Location
    Poland
    MS-Off Ver
    Office 2010
    Posts
    528

    Re: Populate TextBoxes based on 2 Criteria from worksheet Data

    Hi, test my code
    Please Login or Register  to view this content.
    Regards.

  11. #11
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: Populate TextBoxes based on 2 Criteria from worksheet Data

    if that doesn't work for you, then i have a solution (its a kludge though) that will work for you.

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

    Re: Populate TextBoxes based on 2 Criteria from worksheet Data

    Dear maras_mak:

    Thank you so much for your help and input on this. I did test it and it worked very well and achieved what I was looking for.
    Would you mind please explain some of the codes you used as I could not make sense of them, particularly those in red.

    Much appreciated.

    Please Login or Register  to view this content.

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

    Re: Populate TextBoxes based on 2 Criteria from worksheet Data

    dmcgov. maras_mak suggestion was working. Now I just need to understand some of the codes in there. Thanks a lot for your input. Much appreciated.

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

    Re: Populate TextBoxes based on 2 Criteria from worksheet Data

    Hello,
    So attached is part of the real workbook I needed the code for.

    As you can see, nothing happens when the code is put into test.

    This is the code I wrote to reflect the change on the worksheet Overview of course.

    Where do I get it incorrect please? Much appreciated.

    Please Login or Register  to view this content.
    Attached Files Attached Files

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

    Re: Populate TextBoxes based on 2 Criteria from worksheet Data

    Anyone can help fix the code?

    Thank you.

  16. #16
    Valued Forum Contributor
    Join Date
    07-14-2017
    Location
    Poland
    MS-Off Ver
    Office 2010
    Posts
    528

    Re: Populate TextBoxes based on 2 Criteria from worksheet Data

    Hi, you have two identical products - 'White'.
    I changed and added a type to each name.
    I attach the corrected workbook.

    Kind regards,
    Maras.
    Attached Files Attached Files

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

    Re: Populate TextBoxes based on 2 Criteria from worksheet Data

    Hello maras_mak,
    Thanks fo this. I can only test tomorrow morning but wondering what's the rationale behind the changes in the code as compared to the one you initially provided? I think you made a slight change to it.

  18. #18
    Valued Forum Contributor
    Join Date
    07-14-2017
    Location
    Poland
    MS-Off Ver
    Office 2010
    Posts
    528

    Re: Populate TextBoxes based on 2 Criteria from worksheet Data

    Hi, I changed the way of fiscal year search mainly because there was a different data layout in both attachments.
    In the first were the values of a given fiscal year in the first row of the sheet, in the second one there are none.

    Best regards,
    Maras

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

    Re: Populate TextBoxes based on 2 Criteria from worksheet Data

    Hi maras_mak,

    I just test and have play around the updated workbook but unfortunately, nothing was displayed in any TextBox. Do I have to do something to execute the macro?

    Thank you.

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

    Re: Populate TextBoxes based on 2 Criteria from worksheet Data

    I finally managed to make it work by using your initial macro maras_mak. I just added the year row and that has done it.
    Thanks ever so much for your help and I do appreciate it because you made me work and learn more about macro.
    Much appreciated.
    Please Login or Register  to view this content.
    Last edited by rakotonirinas; 07-04-2019 at 04:57 PM. Reason: Incorrect name typed

  21. #21
    Valued Forum Contributor
    Join Date
    07-14-2017
    Location
    Poland
    MS-Off Ver
    Office 2010
    Posts
    528

    Re: Populate TextBoxes based on 2 Criteria from worksheet Data

    I think this is a date format problem.
    For example, if you have the date format "01/05/2019",
    Set fd_rng = .Range ("5: 5"). Find (DateValue ("5-1-" & fsl_yr)) change to Set fd_rng = .Range ("5: 5"). Find (DateValue ("1/5/ "& fsl_yr))

    Greetings.
    Maras.

+ 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. Populate multiple TextBoxes based on ComboBox Selection
    By PTechFL in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-23-2019, 06:35 AM
  2. Replies: 1
    Last Post: 08-07-2018, 05:16 AM
  3. populate textboxes in userform based on cells values
    By Yokosuka in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-08-2016, 01:50 PM
  4. [SOLVED] Populate worksheet textboxes from listbox
    By rodgersmg in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-11-2015, 01:25 AM
  5. How to auto populate specific data to a different worksheet based off a criteria
    By excelnewbie716 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-31-2014, 03:27 PM
  6. Excel 2003: Worksheet cells populate textboxes on a userform
    By SHU_STU_0609 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-09-2013, 01:24 AM
  7. How to populate a second worksheet based on multiple criteria from another worksheet
    By bruce.shoemake in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-14-2012, 05:28 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