+ Reply to Thread
Results 1 to 12 of 12

Copying data from one workbook with drop-down options to another workbook

  1. #1
    Registered User
    Join Date
    02-16-2012
    Location
    Barcelona, Spain
    MS-Off Ver
    2010 Professional
    Posts
    15

    Talking Copying data from one workbook with drop-down options to another workbook

    I am trying to create a macro that will allow me to take data from one workbook and ammend it at the bottom of the other. I am not a programmer and so I have been creating it through keyboard shortcuts however I have hit a particular issue where I get a runtime error 1004 and a message saying application-defines or object defined error. I tried the macro before including the headings of the sheet I was taking data from, but when I try without i.e. starting from the second row it fails. There are drop down menus in a number of cells, if this helps. the code no doubt is messy but looks like this:

    Please Login or Register  to view this content.
    Last edited by toaksie; 02-23-2012 at 05:12 AM. Reason: Title Change

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Creating basic macro but I've hit a snag

    You can actually get rid of all your select and activate statements. Can you specify briefly what data from which file needs to be copied to which file? I can provide you the code or you could alter the following example to suit your needs -
    Please Login or Register  to view this content.
    This code will copy the data from the book titled "First book", sheet1, range A2:J10 to the workbook titled "Second book", Sheet1, next available row.
    Last edited by arlu1201; 02-22-2012 at 06:06 AM.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    02-16-2012
    Location
    Barcelona, Spain
    MS-Off Ver
    2010 Professional
    Posts
    15

    Re: Creating basic macro but I've hit a snag

    Thanks for the reply

    I basically need to take data from a worksheet called "WON" within a workbook called "current", and amend it to the end of a worksheet named "a leads" in a workbook called "ALeads," the idea eventually is to run it to collate individuals results for a month and amend them to the bottom of the main database.

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Creating basic macro but I've hit a snag

    Whats the range in WON that needs to be copied?

  5. #5
    Registered User
    Join Date
    02-16-2012
    Location
    Barcelona, Spain
    MS-Off Ver
    2010 Professional
    Posts
    15

    Re: Creating basic macro but I've hit a snag

    The range is strange (I think it's due to drop down options in many of the cells). When I select the area it simply goes blank however if I see it manually it is A2:T9 although this will change on a month by month basis depending on the number of entries

  6. #6
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Creating basic macro but I've hit a snag

    You can first find which is the last row. Use this -
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    02-16-2012
    Location
    Barcelona, Spain
    MS-Off Ver
    2010 Professional
    Posts
    15

    Re: Creating basic macro but I've hit a snag

    Thanks so much for your help, being a real newb what are the dim statements, the previous post you made?

  8. #8
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Copying data from one workbook with drop-down options to another workbook

    Sorry, i cant reply to you till you change your title as per the admins request - post 7.

  9. #9
    Registered User
    Join Date
    02-16-2012
    Location
    Barcelona, Spain
    MS-Off Ver
    2010 Professional
    Posts
    15

    Re: Copying data from one workbook with drop-down options to another workbook

    I've changed it now sorry all!

  10. #10
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Copying data from one workbook with drop-down options to another workbook

    At the beginning of your code, you need to put the DIM statements which are used to declare the variables you are using. Just below the sub test(), you can put the DIM line.

  11. #11
    Registered User
    Join Date
    02-16-2012
    Location
    Barcelona, Spain
    MS-Off Ver
    2010 Professional
    Posts
    15

    Re: Copying data from one workbook with drop-down options to another workbook

    I'm getting an error that '9' Subscript out of range:

    Please Login or Register  to view this content.

  12. #12
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Copying data from one workbook with drop-down options to another workbook

    Why are you using the copy code twice? All you need is this -
    Please Login or Register  to view this content.
    I missed out some ".", have included those here.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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