+ Reply to Thread
Results 1 to 9 of 9

Macro to take data and insert in a different spreadsheet

  1. #1
    Registered User
    Join Date
    11-27-2012
    Location
    australia
    MS-Off Ver
    Excel 2003
    Posts
    31

    Macro to take data and insert in a different spreadsheet

    Hi everyone. Hopefully one of you can help me out. I have added an attachment to help.

    In simple terms if you open the attachment, I need a macro that:

    1) opens a 2nd spread sheet that contains sheet 2
    2) takes data from sheet 1 and adds it to sheet 2 (sheet 3 is how sheet 2 should look after macro has added data.

    Thanks in advance
    Attached Files Attached Files

  2. #2
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Macro to take data and insert in a different spreadsheet

    Hi paul_sykes00,

    Have you tried to Record a Macro, to help you automate what you want?
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  3. #3
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Macro to take data and insert in a different spreadsheet

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    11-27-2012
    Location
    australia
    MS-Off Ver
    Excel 2003
    Posts
    31

    Re: Macro to take data and insert in a different spreadsheet

    Hi AB33. Thanks for your response but its not quite what i'm looking for. Your code works perfectly for the example given but I need to be more flexible so whatever the date the macro finds it a pastes the job number, job name, type and hours onto the next available line.

    I have attached another example to help clarify this. So on sheet 1 I now have 9 lines of data. Lets assume we enter these lines of data one at a time. After each line is entered we run the macro. After running the macro 8 times I would now want sheet 2 to look like sheet 3.

    Thanks
    Attached Files Attached Files

  5. #5
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Macro to take data and insert in a different spreadsheet

    Hi Paul,
    Sorry! I do not know how to code your needs, but others may know it. I know how to code it using if statement, or select case, but this assumes that you have only a handful of dates(let's say less than 14 days), otherwise the code is going to be Cumbersome, catering for each day of the year( If your data extends for the whole year). I do not imagine your data is 10 rows- this is just a sample? Right? I have tried to use the find and match functions, but I am unable to get the right columns.

  6. #6
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,551

    Re: Macro to take data and insert in a different spreadsheet

    maybe this will help

    Please Login or Register  to view this content.
    Thanks,
    Mike

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved.

  7. #7
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,551

    Re: Macro to take data and insert in a different spreadsheet

    I missed the requirement for the same line for hours. Code assumes that Job number in order.

    Please Login or Register  to view this content.
    Last edited by mike7952; 12-28-2012 at 07:19 AM.

  8. #8
    Registered User
    Join Date
    11-27-2012
    Location
    australia
    MS-Off Ver
    Excel 2003
    Posts
    31

    Re: Macro to take data and insert in a different spreadsheet

    Hi Mike7952,

    Thanks very much for your response. I'm definitely getting much closer to what i'm looking for. A couple of questions though

    1) Code assumes that Job number in order - is it possible to adjust it so this doesn't matter.
    2) If I run it twice it repeats the data - ideally i need it so if I update sheet 1 with new data and then run the macro it doesn't repeat the original data in sheet 2
    3) Sheet 2 will actually be located in a different spreadsheet (i.e c/timesheet.xls). This spreadsheet will include a different tab for every week of the year (example attached). The file path and sheet name will be included in column F of sheet 1. Is it possible to update the macro so it opens the correct spreadsheet and then runs the macro.

    Thanks very much.
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    11-27-2012
    Location
    australia
    MS-Off Ver
    Excel 2003
    Posts
    31

    Re: Macro to take data and insert in a different spreadsheet

    Hi Mike7952,

    I don't suppose you have any further thoughts on the above?

    Thanks again

    Paul

+ 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