+ Reply to Thread
Results 1 to 14 of 14

Copying Data to Another Worksheet - Macro

  1. #1
    Registered User
    Join Date
    01-04-2013
    Location
    London,England
    MS-Off Ver
    Excel 2003
    Posts
    42

    Exclamation Copying Data to Another Worksheet - Macro

    I am making a large macro for a daily report. After creating the macro, I have to copy over the information to condense it with the previous report. I have done so but its recording the amount of rows I am copying and the row that I will be copying it to. Does anyone know how I can program the macro to copy an undefined amount of information to an undefined row?

    I appreciate any advice or help!

  2. #2
    Registered User
    Join Date
    01-04-2013
    Location
    London,England
    MS-Off Ver
    Excel 2003
    Posts
    42

    Exclamation Re: Copying Data to Another Worksheet - Macro

    This is that section of the code:
    Please Login or Register  to view this content.

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

    Re: Copying Data to Another Worksheet - Macro

    Can you specify which rows from which file should be copied to which file in which cell?
    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]

  4. #4
    Registered User
    Join Date
    01-04-2013
    Location
    London,England
    MS-Off Ver
    Excel 2003
    Posts
    42

    Re: Copying Data to Another Worksheet - Macro

    There is no defined number. This macro will be used for various reports.

    Both reports have the same format. I guess you can say Columns A-I have to be copied over but the number of rows in both reports will always change.

    And the worksheet that I will be copying the information will also have an undefined amount of rows... I am trying to condense the information into one spreadsheet.

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

    Re: Copying Data to Another Worksheet - Macro

    Ok, so should data from row 2 to the last row of the source data be copied to the other file?

  6. #6
    Registered User
    Join Date
    01-04-2013
    Location
    London,England
    MS-Off Ver
    Excel 2003
    Posts
    42

    Re: Copying Data to Another Worksheet - Macro

    Now, its row 1. Yes.

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

    Re: Copying Data to Another Worksheet - Macro

    From which file do you want the macro to run? The source file or destination file?

    Also, will the other file (the one that doesnt contain the macro) be open at the time of running the macro or should it be opened by the macro?

  8. #8
    Registered User
    Join Date
    01-04-2013
    Location
    London,England
    MS-Off Ver
    Excel 2003
    Posts
    42

    Re: Copying Data to Another Worksheet - Macro

    Source file.

    Yes. In the macro, it is programmed to open up the destination file.

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

    Re: Copying Data to Another Worksheet - Macro

    Can you post that code please?

  10. #10
    Registered User
    Join Date
    01-04-2013
    Location
    London,England
    MS-Off Ver
    Excel 2003
    Posts
    42

    Re: Copying Data to Another Worksheet - Macro

    Please Login or Register  to view this content.

  11. #11
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Copying Data to Another Worksheet - Macro

    Logically, this looks like it should work:
    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  12. #12
    Registered User
    Join Date
    01-04-2013
    Location
    London,England
    MS-Off Ver
    Excel 2003
    Posts
    42

    Exclamation Re: Copying Data to Another Worksheet - Macro

    That gave me an error on the vlook up code. My vlookup macro is working perfectly. I just need the section to copy and paste.

    Thanks!

  13. #13
    Registered User
    Join Date
    01-04-2013
    Location
    London,England
    MS-Off Ver
    Excel 2003
    Posts
    42

    Re: Copying Data to Another Worksheet - Macro

    I actually found this in another post. I re-worked the information and it worked!

    Please Login or Register  to view this content.
    Thanks for the help JBeaucaire!

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

    Re: Copying Data to Another Worksheet - Macro

    That code can be re-written into just 2 lines -
    Please Login or Register  to view this content.

+ 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