+ Reply to Thread
Results 1 to 11 of 11

Find Dates in Range and Copy Section of Row Into Seperate Worksheet

  1. #1
    Registered User
    Join Date
    08-23-2013
    Location
    Scotland
    MS-Off Ver
    Excel 2003
    Posts
    11

    Find Dates in Range and Copy Section of Row Into Seperate Worksheet

    ExampleSheet.xls

    Hi there

    Please find attached an example workbook.

    In Sheet1 I am looking to check the range (J2:AF100) to find every row that contains January 1st. If a row does contain January 1st I'd like to copy area C:H of that row into the January 1st section in Sheet2.

    I would like this to be able to do this for every day of the year including February 29th and not take the year into account.

    Any Ideas on how to do this.

    Please note that the entire year will be set up in Sheet2 or alternatively monthly in separate worksheets, I'm just using January as a smaller test

    Thanks for taking your time to read this
    Any help would be appreciated
    Last edited by Mackattack; 08-23-2013 at 07:39 AM.

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

    Re: Find Dates in Range and Copy Section of Row Into Seperate Worksheet

    Are you searching in Row2 ONLY as you seem to have January Dates in rows 3-4 as well? If it is row2 only, you have 4 dates to return.

  3. #3
    Registered User
    Join Date
    08-23-2013
    Location
    Scotland
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Find Dates in Range and Copy Section of Row Into Seperate Worksheet

    Hi AB33,

    I should have been more clear. I would like it search the whole range J2:AAF100, so row 2 to row 100 e.g. everytime it finds January 8th it will take the row it was found in and add C:H of that row to sheet2.

    So in the case of row 2, yes it will have 4 dates to return. Then it will add to each of those dates to Sheet2 (C2:H2). And then the code will continue to check row 3 (J3:AF3) and add each of those 7 dates to sheet2 (C3:H3).

    Hope that made sense

    Thanks

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

    Re: Find Dates in Range and Copy Section of Row Into Seperate Worksheet

    How about if the date has a duplicate, which one do you return, 10/01/2013?

  5. #5
    Registered User
    Join Date
    08-23-2013
    Location
    Scotland
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Find Dates in Range and Copy Section of Row Into Seperate Worksheet

    Sorry, do you mean if the same date in two different rows? If so, both rows c:h will be added to Sheet2. So for each record a new row will be added in the date filed for the information.

    E.g. if row 2 contained dates 04/01 and 05/01 then c:h in row 2 will be added to both 04/01 and 05/01 in Sheet2, if row 3 also contains 05/01 then c:h in row 3 will also be added to 05/01 in Sheet2.

    Thanks

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

    Re: Find Dates in Range and Copy Section of Row Into Seperate Worksheet

    No, you have only a single date in sheet2 which is a day for 31 days, but when you search in sheet1, you get a duplicate dates. I know because you have merged cell in sheet2, that is two rows are merged in to one and you are assuming two dates can be returned in to a single cell. Merged cells and VBA are not good friends. There is no way to find a value (Date) in a cell if that cell is merged with another cell.

  7. #7
    Registered User
    Join Date
    08-23-2013
    Location
    Scotland
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Find Dates in Range and Copy Section of Row Into Seperate Worksheet

    Ah alright, understood. I've decided to change my approach as a result of what you have told me.

    Please find attached.

    ExampleSheet.xls

    The main change is that I will no longer need to copy each row from sheet1 into its date on sheet2.

    Rather i would like to use the information from rows G:N on sheet1 to subtract from its relative dates in sheet2.

    I was planning on doing this step later but from what you have explained i feel it will be easier to skip my previous idea and just go straight to this step.

    Please note that sheet2 is updated from the inventory worksheet.

    Thanks for your persistence, is this viable?

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

    Re: Find Dates in Range and Copy Section of Row Into Seperate Worksheet

    I do not know what output you are expecting, please include with the attached your desired result.

  9. #9
    Registered User
    Join Date
    08-23-2013
    Location
    Scotland
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Find Dates in Range and Copy Section of Row Into Seperate Worksheet

    ExampleSheet.xls

    Please find attached.

    I have done what you have suggested and showed my desired result. Sheet3 contains my expected results in sheet2 with added comments

    Hope this helps

    thanks

  10. #10
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Find Dates in Range and Copy Section of Row Into Seperate Worksheet

    Hi Mackattack,
    try this
    Please Login or Register  to view this content.
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    08-23-2013
    Location
    Scotland
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Find Dates in Range and Copy Section of Row Into Seperate Worksheet

    Hi Nilem and AB33

    I really appreciate the help from both of you! This looks great, I'll have a play around with it this now and try wrap my head around what you've done.

    Thanks
    Mack

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Posting only a specific section of an array to worksheet range?
    By mc84excel in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 05-02-2013, 11:21 PM
  2. Deleting Row Section without Disrupting Formula Range Outside of Deleted Section
    By JeffNYG23 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-14-2013, 09:10 AM
  3. [SOLVED] VBA to Find a value and copy the range the value is in to a different worksheet
    By Benisato in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-29-2013, 02:03 PM
  4. Find value and copy section of sheet to another
    By twofootgiant in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-16-2011, 08:09 AM
  5. Copy row based on date and then insert into a new worksheet in the correct section
    By calmlaunch in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-14-2011, 01:19 AM

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