+ Reply to Thread
Results 1 to 2 of 2

Help with macro to reformat data into table (rows must contain same date range)

  1. #1
    Registered User
    Join Date
    04-10-2019
    Location
    Ontario
    MS-Off Ver
    2010
    Posts
    1

    Help with macro to reformat data into table (rows must contain same date range)

    Hello,

    Need help with creating this macro as I do not know how to do it. Any help is appreciated.

    I have one sheet called 'Raw Data' the following information is given

    A B C D E (Column Letter)
    Plant START DATE TIME END DATE TIME Location Reason
    Plant 2 Jan 2, 2019 12:00:00 AM Jan 4, 2019 11:59:00 PM Area 1 Reason 3
    Plant 3 Jan 11, 2019 8:38:41 AM Jan 11, 2019 9:30:00 AM Area 1 Reason 2
    Plant 2 Jan 16, 2019 12:00:00 AM Jan 25, 2019 11:59:00 PM Area 2 Reason 2
    Plant 4 Mar 6, 2019 12:00:00 AM Mar 6, 2019 12:37:00 PM Area 4 Reason 1
    Plant 1 Apr 3, 2019 7:00:00 AM Apr 3, 2019 7:30:00 AM Area 1 Reason 1


    I am trying to copy the raw data onto another sheet in the same workbook, but if start date =/= end date, then end date = start date, add a new line and paste the same info as the previous line. Goal: Have the start and end date to be the same date. So the above table would be shown like the following (after the macro)

    A B C D E (Column Letter)
    Plant START DATE TIME END DATE TIME Location Reason
    Plant 2 Jan 2, 2019 12:00:00 AM Jan 2, 2019 11:59:00 PM Area 1 Reason 3
    Plant 2 Jan 3, 2019 12:00:00 AM Jan 3, 2019 11:59:00 PM Area 1 Reason 3
    Plant 2 Jan 4, 2019 12:00:00 AM Jan 4, 2019 11:59:00 PM Area 1 Reason 3
    Plant 3 Jan 11, 2019 8:38:41 AM Jan 11, 2019 9:30:00 AM Area 1 Reason 2
    Plant 2 Jan 16, 2019 12:00:00 AM Jan 16, 2019 11:59:00 PM Area 2 Reason 2
    Plant 2 Jan 17, 2019 12:00:00 AM Jan 17, 2019 11:59:00 PM Area 2 Reason 2
    Plant 2 Jan 18, 2019 12:00:00 AM Jan 18, 2019 11:59:00 PM Area 2 Reason 2
    Plant 2 Jan 19, 2019 12:00:00 AM Jan 19, 2019 11:59:00 PM Area 2 Reason 2
    Plant 2 Jan 20, 2019 12:00:00 AM Jan 20, 2019 11:59:00 PM Area 2 Reason 2
    Plant 2 Jan 21, 2019 12:00:00 AM Jan 21, 2019 11:59:00 PM Area 2 Reason 2
    Plant 2 Jan 22, 2019 12:00:00 AM Jan 22, 2019 11:59:00 PM Area 2 Reason 2
    Plant 2 Jan 23, 2019 12:00:00 AM Jan 23, 2019 11:59:00 PM Area 2 Reason 2
    Plant 2 Jan 24, 2019 12:00:00 AM Jan 24, 2019 11:59:00 PM Area 2 Reason 2
    Plant 2 Jan 25, 2019 12:00:00 AM Jan 25, 2019 11:59:00 PM Area 2 Reason 2
    Plant 4 Mar 6, 2019 12:00:00 AM Mar 6, 2019 12:37:00 PM Area 4 Reason 1
    Plant 1 Apr 3, 2019 7:00:00 AM Apr 3, 2019 7:30:00 AM Area 1 Reason 1
    Last edited by BoyWithNoName; 04-11-2019 at 11:34 AM.

  2. #2
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Re: Help with macro to reformat data into table

    welcome to the forum

    For future reference, please take a moment to read the forum rules and use thread titles that are descriptive of your problem - not what you think the answer might be. (think google search terms?).

    Many members search our previous posts, and thread titles play a big part of the search. I doubt anybody would do a search based on your title?
    Please familiarise yourself with the rules before posting. You can find them here.

+ 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. Macro to Reformat/transpose data into table style
    By antonio32 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-10-2017, 08:29 AM
  2. Reformat data in Table
    By calvinle in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-05-2017, 05:28 PM
  3. Macro to reformat data in horizontal format to a proper Data table
    By dkrishman in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-19-2015, 10:37 AM
  4. Need a macro that will disassemble a table and reformat it for upload
    By banditeb in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-27-2014, 12:53 PM
  5. [SOLVED] Need macro to reformat data
    By s4driver in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-16-2013, 02:39 PM
  6. Macro to reformat data in horizontal format to a proper Data table
    By hkaushal in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-29-2013, 08:47 PM
  7. Reformat a vertical data set to a horizontal table
    By zenmeta4 in forum Excel General
    Replies: 2
    Last Post: 06-04-2009, 03:55 AM

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