+ Reply to Thread
Results 1 to 7 of 7

macro or table? to cut/paste dates vertically

  1. #1
    Registered User
    Join Date
    07-22-2018
    Location
    Denmark
    MS-Off Ver
    Office 365
    Posts
    12

    Question macro or table? to cut/paste dates vertically

    So i used my whole day on this, trying out with macro guides etc., guess its time to ask !

    I have a bunch of numbers, each number is a registered person.
    This person has some different activities with start and end dates.

    When i collect my scheme it will come out like this.
    1.PNG

    But i need som tool to make it like this
    2.PNG

    So it will copy two rows to the right of a person-number and insert it after the two first start/end date.
    (its important they come in order from left to right, not by date but at the same way they go down vertical)

    If it then can delete the rows the dates were copied from so it will end up as last picture it will be a big plus !

    Hope someone can help.
    Attached Files Attached Files
    Last edited by UnpluggedDK; 07-23-2018 at 01:57 PM.

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,969

    Re: macro or table? to cut/paste dates vertically

    Hi, welcome to the forum

    To best describe or illustrate your problem you would be better off attaching a dummy workbook. The workbook should contain the same structure and some dummy data of the same type as the type you have in your real workbook - so, if a cell contains numbers & letters in this format abc-123 then that should be reflected in the dummy workbook.

    To attach a file to your post,
    click advanced (next to quick post),
    scroll down until you see "manage file",
    click that and select "add files" (top right corner).
    click "select files" find your file, click "open" click "upload" click 'done" bottom right. click "submit reply"

    Once the upload is completed the file name will appear below the input boxes in this window.
    You can then close the window to return to the new post screen.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2405
    Posts
    13,427

    Re: macro or table? to cut/paste dates vertically

    Until then maybe ...

    Not with macro but formula wise maybe this? When finished copy F2:M6 and paste values only back into F2:M6. Then delete columns A:C.

    Copy / paste persons into column E. Apply "Remove duplicates".

    In F2:M6
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    A
    B
    C
    D
    E
    F
    G
    H
    I
    J
    K
    L
    M
    1
    Person
    Start date
    End date
    Person
    Start date
    End date
    Start date 2
    End date 2
    Start date 3
    End date 3
    Start date 4
    End date 4
    2
    3789
    22-Jul
    25-Jul
    3789
    22-Jul
    25-Jul
    26-Jul
    29-Jul
    30-Jul
    5-Aug
    3
    3789
    26-Jul
    29-Jul
    2222
    22-Jul
    25-Jul
    26-Jul
    29-Jul
    30-Jul
    5-Aug
    4
    3789
    30-Jul
    5-Aug
    1111
    22-Jul
    25-Jul
    26-Jul
    29-Jul
    5
    2222
    22-Jul
    25-Jul
    7567
    30-Jul
    5-Aug
    6
    2222
    26-Jul
    29-Jul
    8963
    1-Jun
    6-Sep
    7
    2222
    30-Jul
    5-Aug
    8
    1111
    22-Jul
    25-Jul
    9
    1111
    26-Jul
    29-Jul
    10
    7567
    30-Jul
    5-Aug
    11
    8963
    1-Jun
    6-Sep
    Last edited by FlameRetired; 07-22-2018 at 08:50 PM.
    Dave

  4. #4
    Registered User
    Join Date
    07-22-2018
    Location
    Denmark
    MS-Off Ver
    Office 365
    Posts
    12

    Re: macro or table? to cut/paste dates vertically

    Hi and thank you both!

    I have attached an example file to my first post, where there is two arks.
    Input, how i get it
    Output, how i want it to look like.

    I tried to use your formula #FlameRetired, but i guess that im more of a newb to this than i thought myself
    Possible to reupload my dummy-file with some guide-lines. :O!?

    Thank you for great help so far.

  5. #5
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2405
    Posts
    13,427

    Re: macro or table? to cut/paste dates vertically

    I tried to use your formula #FlameRetired, but i guess that im more of a newb to this than i thought myself
    I forgot to mention regional settings. My bad My apologies.

    My guess is your regional settings use semi-colons as argument separators and not commas as my formula above. The attached upload will correct for that at your end.

    In the latest example there are some extra steps.

    In the 'Input' sheet we need to address the blank cells between the "person numbers" by filling those in. Follow these steps. It's faster than hand typing them in yourself: (This is already done in the attached.)
    • Select A2:A20 in the 'Input' sheet.
    • Press the F5 function key on the upper keyboard.
    • Click the "Special ..." in the lower left corner.
    • Click the "radio button" next to "Blanks"
    • Click OK.
    • You will find all the blank cells selected.
    • Without touching anything else type "=" (without the quotes) followed by the UP arrow key. Now while pressing and holding down the Ctrl key hit Enter. That will correctly fill in all the blanks with "person numbers".
    Copy that list and paste into column A of 'Output'.
    While still selected apply the Remove Duplicates feature.
    You will have a list of unique "person numbers".

    Find this formula in B2 filled down and across to I10. This should look different in the workbook uploaded below if I am correct about regional settings.

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    07-22-2018
    Location
    Denmark
    MS-Off Ver
    Office 365
    Posts
    12

    Re: macro or table? to cut/paste dates vertically

    Thank you very much!

    Worked like it should and just how i wanted it !
    And thanks for the extra tips with the f5 function!

    Reputation your way sir.!

    Edit: have no idea how to mark this solved! ^^
    Last edited by UnpluggedDK; 07-24-2018 at 01:35 PM.

  7. #7
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2405
    Posts
    13,427

    Re: macro or table? to cut/paste dates vertically

    Glad to help. Thanks for the feedback and rep.

    Re: Marking the thread Solved ...

    Select Thread Tools from the menu link above your first post. Mark SOLVED. Thanks for asking.

+ 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] Find Max value horizontally and vertically in table
    By SHI.NL in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 04-17-2018, 11:31 AM
  2. How do I split a table vertically.
    By ThePlanner in forum Office 365
    Replies: 1
    Last Post: 02-02-2018, 08:59 PM
  3. [SOLVED] Loop Horizontal (across) to copy and paste Vertically (Down)
    By rubenidas in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 04-29-2016, 06:11 AM
  4. Cut duplicate rows vertically and paste horizontally
    By shreeja178 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-28-2014, 05:54 PM
  5. Replies: 0
    Last Post: 11-27-2012, 10:32 AM
  6. Replies: 1
    Last Post: 07-04-2012, 10:49 AM
  7. Searching a table vertically and Horizontally
    By smokeydawson555 in forum Excel General
    Replies: 3
    Last Post: 06-29-2009, 11:55 PM

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