+ Reply to Thread
Results 1 to 38 of 38

copy data from sheet to another based on two dropdown selection

  1. #1
    Forum Contributor
    Join Date
    06-02-2019
    Location
    libya
    MS-Off Ver
    2010
    Posts
    734

    copy data from sheet to another based on two dropdown selection

    hello
    i try making code copy data from sheet to another based on two dropdown selection h1=name and i1 = month what i would when i select month and name it brings data relating the name and month and if i select month and no selected name bring data relating month and if i select only name without month then bring data name and if no selected month and name then bring all data
    HTML Code: 
    Attached Files Attached Files

  2. #2
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,712

    Re: copy data from sheet to another based on two dropdown selection

    Hi ABDELFATTA,

    Try below code ...
    Please Login or Register  to view this content.
    Last edited by nankw83; 11-07-2020 at 02:25 PM. Reason: Code adjustment
    If I was able to help, you can thank me by clicking the * Add Reputation under my user name

  3. #3
    Forum Contributor
    Join Date
    06-02-2019
    Location
    libya
    MS-Off Ver
    2010
    Posts
    734

    Re: copy data from sheet to another based on two dropdown selection

    thanks nankw83 it works but not what i want still things missed when i select name and empty month it gives me error and the same thing with the month and the name are empty the right when i select only name then ignore the month if the month and name are empty then copy all of data and i note if i select only month for instance dec then copy all of data of months of course is wrong it should copy what i select the only dec month

  4. #4
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,712

    Re: copy data from sheet to another based on two dropdown selection

    Noticed a small glitch in the code & just corrected it before your post ... Try the revised code again in post #2

  5. #5
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: copy data from sheet to another based on two dropdown selection

    Try

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

  6. #6
    Forum Contributor
    Join Date
    06-02-2019
    Location
    libya
    MS-Off Ver
    2010
    Posts
    734

    Re: copy data from sheet to another based on two dropdown selection

    hi, nankw it remains one thing when i select dec month it also copy oct, nov this is not what i want i would copy what i choose specific month if i select dec then copy only dec without copy months

  7. #7
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,712

    Re: copy data from sheet to another based on two dropdown selection

    This is weird ... It is working as expected for me - File attached
    Attached Files Attached Files

  8. #8
    Forum Contributor
    Join Date
    06-02-2019
    Location
    libya
    MS-Off Ver
    2010
    Posts
    734

    Re: copy data from sheet to another based on two dropdown selection

    yes is very weird i checked your file and i see you result month nov but when i run the problem continues i just last thing if you have time this is my mistake i had making clear from the beginning if is possible do that in worksheet change event thanks for your time

  9. #9
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,712

    Re: copy data from sheet to another based on two dropdown selection

    So before making the code a worksheet change event, does the file work as expected for you ?

  10. #10
    Forum Contributor
    Join Date
    06-02-2019
    Location
    libya
    MS-Off Ver
    2010
    Posts
    734

    Re: copy data from sheet to another based on two dropdown selection

    actually still the problem continues , is it version office relating that ?

  11. #11
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,078

    Re: copy data from sheet to another based on two dropdown selection

    I get the same thing, try
    Please Login or Register  to view this content.

  12. #12
    Forum Contributor
    Join Date
    06-02-2019
    Location
    libya
    MS-Off Ver
    2010
    Posts
    734

    Re: copy data from sheet to another based on two dropdown selection

    thanks Fluff now it works actually if i have no data in specific month it gives me error i fixed by on error resume next but if is possible instead of brings me message box this month doesn't contain data

  13. #13
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: copy data from sheet to another based on two dropdown selection

    Assuming years of dates in col.A are all current year.
    Please Login or Register  to view this content.
    Attached Files Attached Files

  14. #14
    Forum Contributor
    Join Date
    06-02-2019
    Location
    libya
    MS-Off Ver
    2010
    Posts
    734

    Re: copy data from sheet to another based on two dropdown selection

    hi, jindon did you test your code in attached file ? it doesn't work for me it doesn't show anything in sheet (result)

  15. #15
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: copy data from sheet to another based on two dropdown selection

    Of course it is working here, but I just realized that the month names in your country is not like jan, feb, mar etc...

    Try change to
    Please Login or Register  to view this content.

  16. #16
    Forum Contributor
    Join Date
    06-02-2019
    Location
    libya
    MS-Off Ver
    2010
    Posts
    734

    Re: copy data from sheet to another based on two dropdown selection

    yes jindon your code works but not like nankw83 and maniacb i have ever explained this part
    when i select month and no selected name bring data relating month and if i select only name without month then bring data name and if no selected month and name then bring all data
    thanks again
    Last edited by ABDELFATTA; 11-08-2020 at 04:40 AM.

  17. #17
    Forum Contributor
    Join Date
    06-02-2019
    Location
    libya
    MS-Off Ver
    2010
    Posts
    734

    Re: copy data from sheet to another based on two dropdown selection

    well done , maniacb your code works as what i want sorry i'm too late to answer you

  18. #18
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: copy data from sheet to another based on two dropdown selection

    OK, this should do.
    Please Login or Register  to view this content.
    Last edited by jindon; 11-08-2020 at 04:45 AM.

  19. #19
    Forum Contributor
    Join Date
    06-02-2019
    Location
    libya
    MS-Off Ver
    2010
    Posts
    734

    Re: copy data from sheet to another based on two dropdown selection

    still missed something when month and name are empty it gives me error it supposes copying all of data

  20. #20
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: copy data from sheet to another based on two dropdown selection

    Ahhh, missed that.
    Add one line in bold.
    Please Login or Register  to view this content.

  21. #21
    Forum Contributor
    Join Date
    06-02-2019
    Location
    libya
    MS-Off Ver
    2010
    Posts
    734

    Re: copy data from sheet to another based on two dropdown selection

    thanks jindon every thing is ok i know my demands are so much but i have last thing if i have no data in specific month i would show message inform me " there is no data for this month"
    thanks again

  22. #22
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: copy data from sheet to another based on two dropdown selection

    Add lines in bold.
    Please Login or Register  to view this content.

  23. #23
    Forum Contributor
    Join Date
    06-02-2019
    Location
    libya
    MS-Off Ver
    2010
    Posts
    734

    Re: copy data from sheet to another based on two dropdown selection

    excellent i just understand this part of code it supposes showing formula in col m but nothing is existed am i right or wrong?

  24. #24
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: copy data from sheet to another based on two dropdown selection

    When both J1 & I1 are blank, M2 should have no formula, means no condition, so full extraction.
    Check after the data transfer, if any row(s) are added below the header, record(s) are transferred, otherwise No data found.

    HTH

  25. #25
    Forum Contributor
    Join Date
    06-02-2019
    Location
    libya
    MS-Off Ver
    2010
    Posts
    734

    Re: copy data from sheet to another based on two dropdown selection

    hi, jindon actually whether month & name are empty or not it doesn't show the formula it 's not important it's minor and curiosity from me the most important copy data based on two selection and multiple condition
    i would thank you and nank maniacb , fluff for your codes and assistance
    best regards,
    abdelfattah

  26. #26
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: copy data from sheet to another based on two dropdown selection

    M2 is covered by the Button, so you can not see.
    Move the button somewhere else and do a step debug, so that you can see the formula when one of H1:I1 cell is/are filled.

  27. #27
    Forum Contributor
    Join Date
    06-02-2019
    Location
    libya
    MS-Off Ver
    2010
    Posts
    734

    Re: copy data from sheet to another based on two dropdown selection

    before i issue post 25 i thought that like you i moved the button but nothing happened

  28. #28
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: copy data from sheet to another based on two dropdown selection

    Impossible,
    You are not doing a step debug...
    Fill H1 or I1 or both and run then code.
    Please Login or Register  to view this content.

  29. #29
    Forum Contributor
    Join Date
    06-02-2019
    Location
    libya
    MS-Off Ver
    2010
    Posts
    734

    Re: copy data from sheet to another based on two dropdown selection

    i did and highlight in stop and show true in m2

  30. #30
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: copy data from sheet to another based on two dropdown selection

    Then select M2 to see the formula in the formula bar.

  31. #31
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: copy data from sheet to another based on two dropdown selection

    Here is my version of the code as a worksheet_change event, as you requested above.

    Please Login or Register  to view this content.

  32. #32
    Forum Contributor
    Join Date
    06-02-2019
    Location
    libya
    MS-Off Ver
    2010
    Posts
    734

    Re: copy data from sheet to another based on two dropdown selection

    thanks maniacb but it doesn't show anything except the headers

  33. #33
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: copy data from sheet to another based on two dropdown selection

    Here is the code in the workbook.
    Attached Files Attached Files

  34. #34
    Forum Contributor
    Join Date
    06-02-2019
    Location
    libya
    MS-Off Ver
    2010
    Posts
    734

    Re: copy data from sheet to another based on two dropdown selection

    yes it works but not all of cases for instance if i select month and name does not work and if i select only month doesn't work so your code works only two cases first when select only name the second when the month and name are no selected
    i hope fixing

  35. #35
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: copy data from sheet to another based on two dropdown selection

    I capitalized the month values on your sheet to make the code work. Jindon and Nankw83 solutions don't have this limitation.

  36. #36
    Forum Contributor
    Join Date
    06-02-2019
    Location
    libya
    MS-Off Ver
    2010
    Posts
    734

    Re: copy data from sheet to another based on two dropdown selection

    jindon did it in post 20# and before it i made clear you can check it
    thanks again

  37. #37
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: copy data from sheet to another based on two dropdown selection

    Here is the updated code

    Please Login or Register  to view this content.
    Last edited by maniacb; 11-09-2020 at 09:46 AM. Reason: updated code

  38. #38
    Forum Contributor
    Join Date
    06-02-2019
    Location
    libya
    MS-Off Ver
    2010
    Posts
    734

    Re: copy data from sheet to another based on two dropdown selection

    many thanks but i have note this is not firs problem face about writing month every code depends on month doesn't work if writing month is not match with office language so in the beginning the code doesn't work if the month by English my office is Arabic then works , is it problem from language or other problem ?

+ 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. Multiple Dropdown selection & Column Groupings based on dropdown selection
    By rabrol in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-20-2018, 10:23 AM
  2. Show a list of data based from dropdown selection
    By reecerito in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 11-09-2016, 03:18 AM
  3. Replies: 11
    Last Post: 05-23-2016, 07:06 PM
  4. Replies: 1
    Last Post: 01-17-2014, 04:00 PM
  5. Sum data based on selection on dropdown menu
    By brama80 in forum Excel General
    Replies: 4
    Last Post: 05-02-2012, 08:01 AM
  6. Excel 2007 : Navigation based on dropdown data selection
    By geekgautam in forum Excel General
    Replies: 3
    Last Post: 04-27-2011, 02:22 AM
  7. Copy cells based on dropdown selection
    By wcnwzrd in forum Excel General
    Replies: 1
    Last Post: 10-16-2009, 01:48 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