+ Reply to Thread
Results 1 to 20 of 20

modifying code to add textboxes for dates to search within name on userform

  1. #1
    Forum Contributor
    Join Date
    02-08-2021
    Location
    africa
    MS-Off Ver
    2016
    Posts
    387

    modifying code to add textboxes for dates to search within name on userform

    good morning !
    long tim ago I got assistance from Jindon .
    the code will calculation the balance for each name when search in textbox1 (look second sheet if anybody wants to
    understand how calculate the balance , the second sheet just as in example to see what happens on userform based on first sheet). now I add textbox5,6 , when search for name in textbox1 and write two dates in textbox5,6 should populate data within two dates for the name , and if I search for data between two dates textbox5,6 without search for name in textbox1, then will populate data within two dates in textbox5,6 .
    thank
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    02-08-2021
    Location
    africa
    MS-Off Ver
    2016
    Posts
    387

    Re: modifying code to add textboxes for dates to search within name on userform

    is there any help

  3. #3
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,295

    Re: modifying code to add textboxes for dates to search within name on userform

    give the attached a trial.
    Attached Files Attached Files
    Torachan,

    Mission statement; Promote the use of Tables, Outlaw the use of 'merged cells' and 'RowSource'.

  4. #4
    Valued Forum Contributor
    Join Date
    08-08-2022
    Location
    Buenos Aires
    MS-Off Ver
    Excel 2019
    Posts
    1,777

    Re: modifying code to add textboxes for dates to search within name on userform

    Hello.
    I show you another way to do it:
    Attached Files Attached Files
    You are always very welcome if you add reputation by clicking the * (bottom left) of each message that has helped you.

  5. #5
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool Hello, another way, another layout !


    The initial post attachment below revamped …

    ► Do you like it ? ► So thanks to click on bottom left star icon « Add Reputation » !
    Attached Files Attached Files
    Last edited by Marc L; 01-30-2023 at 11:02 PM. Reason: wrong attachment ...

  6. #6
    Valued Forum Contributor
    Join Date
    08-08-2022
    Location
    Buenos Aires
    MS-Off Ver
    Excel 2019
    Posts
    1,777

    Re: Hello, another way, another layout !

    Quote Originally Posted by Marc L View Post
    The initial post attachment below revamped …
    Regional settings topic:

    Be careful Marc (with 'c') as IsDate is not able to detect the difference between 31/07/2022 and 07/31/2022: for IsDate both dates are the same.

    And that leads to user confusion: Does the month come first or second?...

  7. #7
    Forum Contributor
    Join Date
    02-08-2021
    Location
    africa
    MS-Off Ver
    2016
    Posts
    387

    Re: modifying code to add textboxes for dates to search within name on userform

    @torachan
    thanks
    there is no code for combobox1 change event !
    should filter data based on name from combobox1 .
    and the column balance shows minus if the value DEBIT column bigger than CREDIT column, it's wrong . should be opposite .
    and dates don't seem to work

  8. #8
    Forum Contributor
    Join Date
    02-08-2021
    Location
    africa
    MS-Off Ver
    2016
    Posts
    387

    Re: modifying code to add textboxes for dates to search within name on userform

    @beyond Excel
    this awesome !
    I want to ask for you two things
    1- if I implement your code for activesheet like the same data structure then I change sheet name to this line
    Please Login or Register  to view this content.
    is that right ?
    2- second sheet is wesome ! but it deletes the borders for last column (BALANCE) even if I fill manually,why?

  9. #9
    Forum Contributor
    Join Date
    02-08-2021
    Location
    africa
    MS-Off Ver
    2016
    Posts
    387

    Re: modifying code to add textboxes for dates to search within name on userform

    thanks Marc,
    I'm surprised using lisview . why you prefer instead of listbox ?
    for me this is the first time using listview .

  10. #10
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: modifying code to add textboxes for dates to search within name on userform


    Quote Originally Posted by beyond Excel View Post
    Regional settings topic
    Well works according to the Regional Settings, not an issue on my side …


    Quote Originally Posted by MKLAQ View Post
    why you prefer instead of listbox ?
    For all the pro features the ListBox does not have any !
    Like the pro layout (grid, cell formatting, individual font color), columns management (width, reorder, sort),
    keys, pictures and icons, … Thanks for the rep' !

  11. #11
    Valued Forum Contributor
    Join Date
    08-08-2022
    Location
    Buenos Aires
    MS-Off Ver
    Excel 2019
    Posts
    1,777

    Re: modifying code to add textboxes for dates to search within name on userform

    Hello MKLAQ.

    Thanks for the +rep.

    a) I thought that the 'CALCULATION' sheet was an auxiliary sheet and therefore I did not pay attention to the issue of formats.
    In the version that I am attaching now, I am controlling the issue of formats automatically through a listObject named 'tblAux'.

    b) In case you use the 'CALCULATION' sheet for more activities, I've changed the way to fill the comboBox1 (with unique values and sorted alphabetically) by a quite efficient method:

    PHP Code: 
    Private Function cbItems(cb As MSForms.ComboBoxAs Variant)
    Dim Q&, i&, k
    cb
    .List = Array(""): UBound(a)
    For 
    2 To Q
      k 
    Application.Match(a(i1), cb.List, 0)
      If 
    IsError(kThen
        k 
    Application.Match(a(i1), cb.List)
        
    cb.AddItem a(i1), k
      End 
    If
    Next
    End 
    Function 
    c) And the following two lines:

    PHP Code: 
    Set Rng Range("'Data'!A1").CurrentRegion
    Set Tbl 
    Range("tblAux").ListObjectTbl.ListColumns.Count 
    are the lines associated with the main data range and the auxiliary listObject.
    Attached Files Attached Files
    Last edited by beyond Excel; 01-31-2023 at 03:16 PM.

  12. #12
    Forum Contributor
    Join Date
    02-08-2021
    Location
    africa
    MS-Off Ver
    2016
    Posts
    387

    Re: modifying code to add textboxes for dates to search within name on userform

    thanks Marc for the clarification and solution

  13. #13
    Forum Contributor
    Join Date
    02-08-2021
    Location
    africa
    MS-Off Ver
    2016
    Posts
    387

    Re: modifying code to add textboxes for dates to search within name on userform

    @beyond Excel
    thanks very much for your time and solutions.

  14. #14
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: modifying code to add textboxes for dates to search within name on userform


    Quote Originally Posted by beyond Excel View Post
    b) In case you use the 'CALCULATION' sheet for more activities, I've changed the way to fill the comboBox1
    Could be done with a single MATCH function …

  15. #15
    Valued Forum Contributor
    Join Date
    08-08-2022
    Location
    Buenos Aires
    MS-Off Ver
    Excel 2019
    Posts
    1,777

    Re: modifying code to add textboxes for dates to search within name on userform

    Quote Originally Posted by Marc L View Post
    Could be done with a single MATCH function …
    You mean?:

    PHP Code: 
    For 2 To Q
      k 
    Application.Match(a(i1), cb.List)
      If 
    cb.List(1) < a(i1Then cb.AddItem a(i1), k
    Next 

  16. #16
    Valued Forum Contributor
    Join Date
    08-08-2022
    Location
    Buenos Aires
    MS-Off Ver
    Excel 2019
    Posts
    1,777

    Re: modifying code to add textboxes for dates to search within name on userform

    Quote Originally Posted by MKLAQ View Post
    @beyond Excel
    thanks very much for your time and solutions.
    It was a pleasure to help you in your work and see you next time.

  17. #17
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: modifying code to add textboxes for dates to search within name on userform


    Quote Originally Posted by beyond Excel View Post
    You mean?
    Something like that as with a non exact MATCH no need an exact MATCH before …


    Quote Originally Posted by MKLAQ View Post
    I'm surprised using lisview . why you prefer instead of listbox ?
    See the below attachment variation …
    Attached Files Attached Files

  18. #18
    Forum Contributor
    Join Date
    02-08-2021
    Location
    africa
    MS-Off Ver
    2016
    Posts
    387

    Re: modifying code to add textboxes for dates to search within name on userform

    @Marc
    again thanks for new version .
    listview tool seems great !
    I have to search how using this tool .

  19. #19
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: modifying code to add textboxes for dates to search within name on userform


    Thanks for the rep' !

    You have an idea 'how to' within my VBA procedures UserForm_Initialize (headers) & ViewRows
    and see also ressources on some Microsoft website to know more …

  20. #20
    Valued Forum Contributor
    Join Date
    08-08-2022
    Location
    Buenos Aires
    MS-Off Ver
    Excel 2019
    Posts
    1,777

    Re: modifying code to add textboxes for dates to search within name on userform

    Quote Originally Posted by Marc L View Post
    Something like that as with a non exact MATCH no need an exact MATCH before

    That is -coincidentally- what I am showing you: see post #15.

+ 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] modifying code print out based on search on userform
    By ABDELFATTA in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-17-2020, 04:37 AM
  2. Find/Search within Userform Textboxes
    By liquidmettle in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-16-2019, 08:36 AM
  3. Userform; search/match two textboxes and then update that row
    By ckaten in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-30-2018, 09:48 AM
  4. [SOLVED] Dates and formatting TextBoxes in a Userform
    By j_Southern in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-18-2016, 05:34 AM
  5. Userform Textboxes and dates
    By AndyRoo119 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-13-2016, 03:07 PM
  6. Chronological Dates In TextBoxes On UserForm
    By yoshi_5 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-29-2015, 09:35 AM
  7. Userform populate listbox with search from multiple textboxes
    By chendysworld in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-12-2012, 11:12 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