+ Reply to Thread
Results 1 to 12 of 12

Copy entire row FROM ONE worksheet TO MULTIPLE worksheets IF criteria met

  1. #1
    Registered User
    Join Date
    01-31-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    6

    Copy entire row FROM ONE worksheet TO MULTIPLE worksheets IF criteria met

    Hi everyone,
    This forum has been great in helping me with VBA's, but I'm now looking for a complicated macro which I have not seen here yet..

    I have a master sheet with many rows and columns, relating to jobs. Column H lists date and time in this format: DD/MM TTTTz (e.i 31/01 0800z) I would very much appreciate a macro which would copy entire rows from this master sheet to sheets called "january", "february", "march" etc. according to cell H in my master sheet. The problem is that column H needs to stay in the same format (DD/MM TTTTz).

    Since I want to avoid having duplicated rows in january, feruary, march, etc. I would also like the macro to delete duplicate rows but not only according to row H (more than one job can be posted at the same time) but also according to row D and F.

    Any ideas would be greatly appreciated!
    Many thanks!
    Luke

  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: Copy entire row FROM ONE worksheet TO MULTIPLE worksheets IF criteria met

    Please attach a sample file.

    To Attach a File:

    1. Click on Go Advanced
    2. In the frame Attach Files you will see the button Manage Attachments
    3. Click the button.
    4. A new window will open titled Manage Attachments - Excel Forum.
    5. Click the Browse... button to locate your file for uploading.
    6. This will open a new window File Upload.
    7. Once you have located the file to upload click the Open button. This window will close.
    8. You are now back in the Manage Attachments - Excel Forum window.
    9. Click the Upload button and wait until the file has uploaded.
    10. Close the window and then click Submit.
    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
    01-31-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Copy entire row FROM ONE worksheet TO MULTIPLE worksheets IF criteria met

    hi arlu1201 - here's the file, thanks for your help (and the upload instructions)
    Attached Files Attached Files

  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: Copy entire row FROM ONE worksheet TO MULTIPLE worksheets IF criteria met

    Any reason why the z after the date? This will make it very tough to find out in which month the row belongs to.

  5. #5
    Registered User
    Join Date
    01-31-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Copy entire row FROM ONE worksheet TO MULTIPLE worksheets IF criteria met

    hi arlu1201, the "z" in time stands for ZULU- universal time, due to the nature of our business we cannot work in local times and company guidelines make us add the "z". Unfortunately, I can't get rid of it...I was thinking of a macro which would look into cells in row H and identify the 4th and 5th character, if the 4th character = 1 and the 5th character = 2 then 12 = december, if the 4th character = 0 and the 5th character=3 then 03=March...but I had no idea how to put that into a code...Do you think it's possible?

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

    Re: Copy entire row FROM ONE worksheet TO MULTIPLE worksheets IF criteria met

    Maybe this will work, assumes you have data in column A on master sheet.

    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
    Registered User
    Join Date
    01-31-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Copy entire row FROM ONE worksheet TO MULTIPLE worksheets IF criteria met

    Hi Mike,
    Thanks for the code, but I'm getting an error on this line:
    sMonth = Split(Left$(aArr(i, 8), 5), "/")(1) & "/" & Format(Date, "yyyy")

    Any ides?
    Thanks,
    Luke

  8. #8
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,520
    Are you running on a Mac or PC?

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

    Re: Copy entire row FROM ONE worksheet TO MULTIPLE worksheets IF criteria met

    Another thing, have you change the layout of workbook? Are the strings "22/01 1230z" still in Column H?

  10. #10
    Registered User
    Join Date
    01-31-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Copy entire row FROM ONE worksheet TO MULTIPLE worksheets IF criteria met

    Hi Mike, I'm using a PC and Microsoft excel 2010..
    I put all the data in a test workbook and moved rows by mistake so apologies for my previous post... Your macro is working, but it somehow stops copying from my "master" sheet on row 41.. I will keep adding entries to my "master" sheet so is there a way to extend it beyond row 41?

    I can't thank you enough Mike!!
    Luke

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

    Re: Copy entire row FROM ONE worksheet TO MULTIPLE worksheets IF criteria met

    Try replacing this
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    01-31-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Copy entire row FROM ONE worksheet TO MULTIPLE worksheets IF criteria met

    Mike this is brilliant!!

    I honestly can't thank you enough!

    Luke

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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