+ Reply to Thread
Results 1 to 19 of 19

Copy data when selecting a drop dwon seletion

  1. #1
    Registered User
    Join Date
    06-28-2015
    Location
    North East, England
    MS-Off Ver
    2010
    Posts
    39

    Copy data when selecting a drop dwon seletion

    Hi

    Can anyone help me with a bit of code. Im trying to copy a selection of data from a seperate workbook and paste it into my active sheet when the user selects certain Month from a drop down list. This is how far i have go but i can't get it to work.

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Copy data when selecting a drop dwon seletion

    Try:
    Please Login or Register  to view this content.
    This allows you to specify the source workbook, worksheet and range for each value in your dropdown.
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  3. #3
    Registered User
    Join Date
    06-28-2015
    Location
    North East, England
    MS-Off Ver
    2010
    Posts
    39

    Re: Copy data when selecting a drop dwon seletion

    Olly

    Thank you for this, However i cant seem to get this code to work. When i select 'September' from the dropdown nothing happens. Its need to open a file path then copy certain cells to the orignal workbook

  4. #4
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Copy data when selecting a drop dwon seletion

    Where did you put the code?

    Attach your workbook, please.

  5. #5
    Registered User
    Join Date
    06-28-2015
    Location
    North East, England
    MS-Off Ver
    2010
    Posts
    39

    Re: Copy data when selecting a drop dwon seletion

    I assigned the Macro on Dropdown4, in Module1.

    I have done a simmple copy of my workbooks as i cant attached the origanls.
    Attached Files Attached Files

  6. #6
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Copy data when selecting a drop dwon seletion

    Okay, change your code slightly, to this:
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    06-28-2015
    Location
    North East, England
    MS-Off Ver
    2010
    Posts
    39

    Re: Copy data when selecting a drop dwon seletion

    cheers i will check this out tomorrow. my next step will be to put filepaths in for the rest of the Months

  8. #8
    Registered User
    Join Date
    06-28-2015
    Location
    North East, England
    MS-Off Ver
    2010
    Posts
    39

    Re: Copy data when selecting a drop dwon seletion

    This works good thank you. I also want to copy data from other workbooks into other cells. how would i amend the code?

  9. #9
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Copy data when selecting a drop dwon seletion

    Try this:
    Please Login or Register  to view this content.
    For each value in your dropdown, change the relevant values in the "Case " section, to indicate the source file, source range, and target range.

  10. #10
    Registered User
    Join Date
    06-28-2015
    Location
    North East, England
    MS-Off Ver
    2010
    Posts
    39

    Re: Copy data when selecting a drop dwon seletion

    Thank you. I have managed to link up all the months now. The next problem i have is that i need to pull data not just from one workbook and place for every month. could a just duplice the code below?
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Thanks for all your help with this

  11. #11
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Copy data when selecting a drop dwon seletion

    Quote Originally Posted by stanton17 View Post
    Thank you. I have managed to link up all the months now. The next problem i have is that i need to pull data not just from one workbook and place for every month.
    Sorry, I don't understand this. What are you trying to do?

  12. #12
    Registered User
    Join Date
    06-28-2015
    Location
    North East, England
    MS-Off Ver
    2010
    Posts
    39

    Re: Copy data when selecting a drop dwon seletion

    sorry i dont think i explain it very well. At the moment when selecting a month, say september the code looks at workbook stanton17_sep.xlsm and then copies E6:I10 from sheet1

    What i also need to do is at the same time is look at other wookbooks say 'C:\temp\stanton17_sep_workbook2.xlsm' and copy A1:A10 from sheet1 and do that for as many workbooks i want.

    The reason is i have data on several different workbooks i need to pull into the sheet with the month selector on.

  13. #13
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Copy data when selecting a drop dwon seletion

    Is it a fixed number of workbooks per month selection?

  14. #14
    Registered User
    Join Date
    06-28-2015
    Location
    North East, England
    MS-Off Ver
    2010
    Posts
    39

    Re: Copy data when selecting a drop dwon seletion

    Yes its 7 workbooks every month. The workbook with the month selector is a Dashboard, a collection of data from the 7 workbooks

  15. #15
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Copy data when selecting a drop dwon seletion

    And is it 7 different workbooks for each month?
    Or is it the same 7 workbooks, but a different RANGE for each month?

  16. #16
    Registered User
    Join Date
    06-28-2015
    Location
    North East, England
    MS-Off Ver
    2010
    Posts
    39

    Re: Copy data when selecting a drop dwon seletion

    hi its 7 different workbooks for each month

  17. #17
    Registered User
    Join Date
    06-28-2015
    Location
    North East, England
    MS-Off Ver
    2010
    Posts
    39

    Re: Copy data when selecting a drop dwon seletion

    When a month is selected then the data need to put from 7 different workbook and 7 different ranges at the sametime into different cells on the dropdown sheet. Then when you select a different month it will pull data from worksheets called the next month.

    I hope you understand this

    cheers
    Last edited by stanton17; 10-30-2016 at 06:53 AM.

  18. #18
    Registered User
    Join Date
    06-28-2015
    Location
    North East, England
    MS-Off Ver
    2010
    Posts
    39

    Re: Copy data when selecting a drop dwon seletion

    Hi its 7 different workbooks for each month. there is upto 7 spreadsheet people complete that i need data to feed into the month selector workbook, then the next month the 7 spreadsheets will be copied and renamed the next month. I hope this makes sence?

    Many thanks

  19. #19
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Copy data when selecting a drop dwon seletion

    It's quite hard to make efficient code without understanding your source workbook structure.

    Worst case is there are 84 workbooks, each with a unique name, worksheet name, source range and target range. So, I could code it to define 84 x 4 bits of information, and loop through the relevant 7 x 4, based on the selected month...

    I bet there's a more efficient way, though - I bet you have some consistent naming conventions, some consistent source and target ranges... so I bet we don't actually have to specify 84 x 4 bits of source information. However - without an understanding of your actual structures and names, it's impossible to work this out...

    See the attached workbook - it contains a single table, to map out your import specification. If you can complete this table, then we can look at the most efficient way of importing the data, from the 84 source files.
    Attached Files Attached Files

+ 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. Help with selecting data link via two drop down lists.
    By DanBurke92 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 02-04-2015, 11:11 AM
  2. Display Data after selecting Name from Drop down list
    By dhu0511 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 11-11-2014, 09:55 AM
  3. Replies: 2
    Last Post: 08-01-2013, 07:36 AM
  4. how to autofill data by selecting from drop list?
    By poodelek in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-05-2013, 02:03 PM
  5. Replies: 3
    Last Post: 04-16-2012, 10:14 PM
  6. using vba to copy dwon formulas
    By ctrulin in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-28-2012, 02:04 PM
  7. Display more data after selecting from drop-down box.
    By CJMathias in forum Excel General
    Replies: 7
    Last Post: 10-23-2010, 10:36 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