+ Reply to Thread
Results 1 to 7 of 7

Macro to copy data from worksheet (name changes daily) to master workbook

  1. #1
    Registered User
    Join Date
    05-05-2008
    Posts
    45

    Macro to copy data from worksheet (name changes daily) to master workbook

    I am trying to come up with a macro that will copy the data from a worksheet name "CPHP060908" (date changes daily) and paste it into a seperate master workbook to a tab named "CP HP". If anyone has any idea how this can be done I would greatly appreciate it. I know it is probably a very easy fix but as usual I'm trying to make it too complicated.

    Thanks in advance!

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Place your code in the master workbook. From the code use the FileOpen dialog to get the file to copy from. Then this will be the activeworkbook in your code.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    05-05-2008
    Posts
    45
    Quote Originally Posted by royUK
    Place your code in the master workbook. From the code use the FileOpen dialog to get the file to copy from. Then this will be the activeworkbook in your code.
    I was planning on putting the code in the master workbook with a button assigned to opening and copy/paste the information from the new file. Unfortunately being relatively new to vba/macro I'm not familiar with the FileOpen dialog and the search feature does not seem to be much help. If you would mind elaborating a bit it would be greatly appreicated!

    Thanks for your help!

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    This code will prompt the user to open the file for importing the data.
    Please Login or Register  to view this content.
    In the opened workbook is the sheet name always the same but updated by the date in this format-060908, are you copying all the data from that sheet?

    In the destination workbook are you adding to the data already saved?

  5. #5
    Registered User
    Join Date
    05-05-2008
    Posts
    45
    Please take a look at the attached spreadsheets. The first workbook is the master workbook "FORUM TEST Daily Exchange" where the macro will be placed. From this master workbook I need to paste the data from the second workbook (rscyclecount) and sort it by column H (Last Name) Ascending. The one "snag" that I know will cause some confusion is getting the data to the correct tab. When I run the report to pull the data by computer brand (HP = Hewlett Packard, TS = Toshiba, SO = Sony, etc...) the reports all import to Excel with the same file name "rsCycleCount_Report" with no distinguishable difference. So basically I need to get the data off of the HP report titled "reCycleCount_Report" into the CP HP tab in the master workbook as well as the othe brand names into their correct tabs... Confused yet? I know I am!!!
    Attached Files Attached Files

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    The data layout makes it very difficult to work with. Is the report workbook fixed in that format?

    Also I would not have separate sheets for each brand, but use one sheet & a PivotTable or AutoFilter to view each brand

  7. #7
    Registered User
    Join Date
    05-05-2008
    Posts
    45
    Quote Originally Posted by royUK
    The data layout makes it very difficult to work with. Is the report workbook fixed in that format?

    Also I would not have separate sheets for each brand, but use one sheet & a PivotTable or AutoFilter to view each brand
    Unfortunately the format is fixed when I import the report into Excel...

+ 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