+ Reply to Thread
Results 1 to 14 of 14

VBA Code assistance to populate textbox with lookup sales total via date pickers

  1. #1
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,236

    VBA Code assistance to populate textbox with lookup sales total via date pickers

    Hi All

    I have a simple Userform with two date picker controls. When pressing the command button, I want to populate textbox1 with the total sales value between the dates chosen in the datepickers. I have attached my sample file.
    Code I need to fix is as follows:
    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,236

    Re: VBA Code assistance to populate textbox with lookup sales total via date pickers

    Not sure if I'm on the right track

    Please Login or Register  to view this content.

  3. #3
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,236

    Re: VBA Code assistance to populate textbox with lookup sales total via date pickers

    Hi Guys

    It's been hours and I'm still getting nowhere...Any advice or link references please.

    Please Login or Register  to view this content.
    Last edited by sintek; 08-10-2016 at 07:05 AM.

  4. #4
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,236

    Re: VBA Code assistance to populate textbox with lookup sales total via date pickers

    Hi All

    I still have no solution. Any way of getting my unsolved thread to top of page again. Am really stuck.

  5. #5
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,236

    Re: VBA Code assistance to populate textbox with lookup sales total via date pickers

    I've changed the code to below and now I get a result of "0". Where am I going wrong?
    Please Login or Register  to view this content.

  6. #6
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,236

    Re: VBA Code assistance to populate textbox with lookup sales total via date pickers

    Hi All

    I have now named my ranges and am using the below code. Have also attached my file. Still gets a zer reading. Anyone out there PLEASE!!!!!!!

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

  7. #7
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,236

    Re: VBA Code assistance to populate textbox with lookup sales total via date pickers

    Now I'm really frustrated....
    My Formula works: D8 =SUMIFS(sales,date,">="&D3,date,"<="&D4) but my code does not:

    Please Login or Register  to view this content.

  8. #8
    Valued Forum Contributor bulina2k's Avatar
    Join Date
    11-20-2012
    Location
    Urziceni, Ialomita, Romania
    MS-Off Ver
    2019 and 365
    Posts
    861

    Re: VBA Code assistance to populate textbox with lookup sales total via date pickers

    Can you upload a sample file please?
    Something so we could recreate your results?

    LE: wait, I have just downloaded yout file...
    .. and don't forget to have fun!
    Bogdan.

    mark SOLVED and Add Reputation if my answer pleases you

  9. #9
    Valued Forum Contributor bulina2k's Avatar
    Join Date
    11-20-2012
    Location
    Urziceni, Ialomita, Romania
    MS-Off Ver
    2019 and 365
    Posts
    861

    Re: VBA Code assistance to populate textbox with lookup sales total via date pickers

    Ok I think we're on the right track, try this:

    Please Login or Register  to view this content.

  10. #10
    Valued Forum Contributor bulina2k's Avatar
    Join Date
    11-20-2012
    Location
    Urziceni, Ialomita, Romania
    MS-Off Ver
    2019 and 365
    Posts
    861

    Re: VBA Code assistance to populate textbox with lookup sales total via date pickers

    Oh and another think I forgot to mention. I defined the range in the file as a table. (Select any cell in the table and go to Insert->Table Excel will name it Table1 as default)

  11. #11
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,236

    Re: VBA Code assistance to populate textbox with lookup sales total via date pickers

    bulina2k.... you are a genius!!!!!

    Thank you...Thank you

    I have been struggling for 2 days to sort this out. Couldn't find the correct vba syntax on the web to make it work.
    So here, thanks to you, Is the code:

    Please Login or Register  to view this content.

  12. #12
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,236

    Re: VBA Code assistance to populate textbox with lookup sales total via date pickers

    bulina2k....A quick question...If I were to add a column between date ans sales called Payment which contained "Cash" or "Cheque" would I amend the code as follows to give me the total of Cash sales for the dates.
    Please Login or Register  to view this content.

  13. #13
    Valued Forum Contributor bulina2k's Avatar
    Join Date
    11-20-2012
    Location
    Urziceni, Ialomita, Romania
    MS-Off Ver
    2019 and 365
    Posts
    861

    Re: VBA Code assistance to populate textbox with lookup sales total via date pickers

    no no no...
    sumifs takes its parameters/argumets like this:
    Arg1 : the range to be summed
    Arg2 pairing with Arg3 : Range of the criteria1 paired with criteria1
    Arg4 pairing with Arg5 : : Range of the criteria2 paired with criteria2
    ... and so on
    So you should modify your code like

    Please Login or Register  to view this content.

  14. #14
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,236

    Re: VBA Code assistance to populate textbox with lookup sales total via date pickers

    now I get it....Lesson well learn t
    It so much simpler with formulas.

    Thanks again bulina2k

+ 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] Vba assistance with UserForm Textbox search code
    By sintek in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-05-2016, 09:02 AM
  2. [SOLVED] VBA Code assistance for Hyperlink populate Loop
    By sintek in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-14-2016, 01:24 PM
  3. VBA code to replicate Oultook Appointment Date and Time pickers for Start and End times
    By brucemc777 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-26-2016, 03:20 PM
  4. Date Pickers
    By Shellybelly in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-27-2015, 02:52 PM
  5. user forms and date pickers
    By Shellybelly in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-26-2015, 11:32 PM
  6. VBA lookup value in combo box, to populate value in textbox
    By afwelch87 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-15-2014, 11:07 AM
  7. [SOLVED] Date Pickers on a MultiPage control
    By Larry in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-08-2005, 04:06 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