+ Reply to Thread
Results 1 to 11 of 11

merging data based on sheet name using combobox from userform

  1. #1
    Forum Contributor
    Join Date
    05-08-2021
    Location
    ALQUDS
    MS-Off Ver
    2019
    Posts
    210

    merging data based on sheet name using combobox from userform

    Hi
    I need merging duplicates items based on column D for QTY in column E and show price average for column F and show in listbox based on selected sheet from combobox1 except STOCK sheet will show as in sheet without any price average with ignore the others columns from showing in listbox .each sheet should merging alone for duplicates items.

    when select sheet should from combobox1 should merge the QTY and show average price to unit price column and QTY* UNIT PRICE in listbox for instance as in picture 1 for case1 in last sheet.
    and if the combobox1 is empty then will create names headers based on sheets names and show QTY every sheet after merge and the column QTY in listbox will calculate across sheets like this STOCK+BBR-BMTR+VSR-STR , and the BALANCE column = QTY column * UNIT PRICE column but when create unit price should be average price based on two sheets together STOCK,BBR when merge the ID .result when combobox1 is empty as in case2 for picture2 in last sheet.
    when matching ID for all of sheets will be in the same location except STOCK sheet,please be careful.
    also psted here
    https://www.mrexcel.com/board/thread...bobox.1251982/
    Attached Files Attached Files
    Last edited by Hasson; 02-26-2024 at 08:59 AM.

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,321

    Re: merging data based on sheet name using combobox from userform

    Please Login or Register  to view this content.
    "RUN" on Sheet "Result on Form"

    "SUMMARY" button to produce 2nd output
    Attached Files Attached Files
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  3. #3
    Forum Contributor
    Join Date
    05-08-2021
    Location
    ALQUDS
    MS-Off Ver
    2019
    Posts
    210

    Re: merging data based on sheet name using combobox from userform

    very perfect !
    just I need fixing error "subscript out of range when clear combobox1 to press Summary button to calculation across sheets in this line
    Please Login or Register  to view this content.
    and what does mean bold some parts ReDim arr(1 To 50, 1 To 11) or
    Please Login or Register  to view this content.
    1 to 50 how many rows for each sheet , 1 to 11 how many columns for each sheet ?

  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,321

    Re: merging data based on sheet name using combobox from userform

    Post file with errors.

    50 is number of ITEMS : what is the maximum ?

    Please Login or Register  to view this content.
    Change 50 as required.

    The other error means Combobox has an invalid sheet name OR more likely sheet not found: list is below.

    ws = Array("BBR", "STR", "BMTR", "VSR")
    Last edited by JohnTopley; 02-27-2024 at 03:28 AM.

  5. #5
    Forum Contributor
    Join Date
    05-08-2021
    Location
    ALQUDS
    MS-Off Ver
    2019
    Posts
    210

    Re: merging data based on sheet name using combobox from userform

    Post file with errors.
    I used your attacing .
    50 is number of ITEMS : what is the maximum ?
    at least 300
    what about 11 ?
    Change 50 as required.
    understood .
    The other error means Combobox has an invalid sheet name OR more likely sheet not found: list is below.
    look if the selected sheet from combobox1 and click SUMMARY button will populate data for all of sheets , this is not sense !
    to avoid this until the user understand how the project works forthe right way is when click summary should clear combobox1 and populate data for all of sheets , also when clear combobox1 and click summary to populate all of data sheet otherwise when combobox1 contain sheet name then just populate for the selected sheet.
    thanks again

  6. #6
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,321

    Re: merging data based on sheet name using combobox from userform

    You either select from Combobox OR Summary, not both: I used Summary rather than add a "dummy" entry e.g. ALL in the combobox for the second option.

    This is obvious in that selecting from the combobox gives the "sheet" results!

    11 is the number of "columns" in listbox for the SUMMARY requirement.
    Last edited by JohnTopley; 02-27-2024 at 05:48 AM.

  7. #7
    Forum Contributor
    Join Date
    05-08-2021
    Location
    ALQUDS
    MS-Off Ver
    2019
    Posts
    210

    Re: merging data based on sheet name using combobox from userform

    You either select from Combobox OR Summary, not both
    ok to just use Summary and I have already selected sheet from combobox1 ,then I have to clear combobox1 , but will show error when clear combobox1 if I just use Summary , not both as you suggst !

  8. #8
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,321

    Re: merging data based on sheet name using combobox from userform

    Click "RUN"

    For a sheet, select from the combobox and the listbox data is added.

    for All sheets, just click "Summary" and the listbox data is added: there is no need to clear the combobox.

    .

  9. #9
    Forum Contributor
    Join Date
    05-08-2021
    Location
    ALQUDS
    MS-Off Ver
    2019
    Posts
    210

    Re: merging data based on sheet name using combobox from userform

    you mean I shouldn't clear combobox1 ?

  10. #10
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,321

    Re: merging data based on sheet name using combobox from userform

    YES.. that is what I said!

    there is no need to clear the combobox

  11. #11
    Forum Contributor
    Join Date
    05-08-2021
    Location
    ALQUDS
    MS-Off Ver
    2019
    Posts
    210

    Re: merging data based on sheet name using combobox from userform

    I think finding solution by use
    Please Login or Register  to view this content.
    thank you so much John.

+ 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] populate sheet based on criteria selected in userform combobox.
    By ANDREAAS in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-01-2019, 04:00 PM
  2. Transfer data to sheet based on Userform combobox selection
    By jackt05 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-17-2019, 10:11 AM
  3. UserForm Search Specific Sheet based on ComboBox
    By jimmisavage in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-28-2017, 07:29 AM
  4. UserForm Search Specific Sheet based on ComboBox
    By jimmisavage in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 06-26-2017, 07:24 AM
  5. [SOLVED] Userform- conditional transfer of data based on combobox value
    By KK1234 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-12-2016, 03:54 AM
  6. Replies: 0
    Last Post: 08-18-2015, 04:13 PM
  7. [SOLVED] Copy userform data to a second sheet based on ComboBox value?
    By matrixpom in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 11-08-2012, 09:09 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