+ Reply to Thread
Results 1 to 15 of 15

Macros - Delete Columns, Cut & Paste Columns then Sorted by Column

  1. #1
    Forum Contributor
    Join Date
    03-05-2015
    Location
    Playa Del Carmen, Mexico
    MS-Off Ver
    2016
    Posts
    111

    Macros - Delete Columns, Cut & Paste Columns then Sorted by Column

    I have a report that requires manipulation. It has entries from columns A-AU. Firstly I need the following columns deleted,

    B,D,F,H,I,K,N-Q,S-U,Y-AU (As shown in the attached example in Sheet2)

    Then the columns have to be moved as follows: (old position then new position)

    A - A,
    D - B
    B - C (Simply by moving D-B I guess)
    E - D
    I - E
    K - F
    J - G
    G - H
    F - I
    H - J
    C - K

    (Final example is in Sheet3)

    Finally all records need to be sorted by column B.


    Any help would be hugely appreciated.
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Macros - Delete Columns, Cut & Paste Columns then Sorted by Column

    Try
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    03-05-2015
    Location
    Playa Del Carmen, Mexico
    MS-Off Ver
    2016
    Posts
    111

    Re: Macros - Delete Columns, Cut & Paste Columns then Sorted by Column

    Thank you so very much. Is the code in there to sort by column B at the end because if so it isn't working.

  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Macros - Delete Columns, Cut & Paste Columns then Sorted by Column

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    03-05-2015
    Location
    Playa Del Carmen, Mexico
    MS-Off Ver
    2016
    Posts
    111

    Re: Macros - Delete Columns, Cut & Paste Columns then Sorted by Column

    Hi Jindon, I'm ever so sorry to bother you but I need to edit the code you provided for me and I'm at a loss as to why it isn't working as I do not understand the last section. I have been asked to add a couple of columns that we'd previously deleted. These are H & K. I've amended the range value below and provided the new order but it doesn't work.

    Please Login or Register  to view this content.
    Also, apologies for not adding reputation or saying thank you previously. I have a few other threads going and this was an oversight on my part.

  6. #6
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Macros - Delete Columns, Cut & Paste Columns then Sorted by Column

    See if this how you wanted.
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    03-05-2015
    Location
    Playa Del Carmen, Mexico
    MS-Off Ver
    2016
    Posts
    111

    Re: Macros - Delete Columns, Cut & Paste Columns then Sorted by Column

    I'm getting an error... Subscript out of range.

  8. #8
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Macros - Delete Columns, Cut & Paste Columns then Sorted by Column

    ........................
    Attached Files Attached Files

  9. #9
    Forum Contributor
    Join Date
    03-05-2015
    Location
    Playa Del Carmen, Mexico
    MS-Off Ver
    2016
    Posts
    111

    Re: Macros - Delete Columns, Cut & Paste Columns then Sorted by Column

    Thank you but this seems to be the same outcome as before. I am missing columns H & K. (Segmento and T.Cto) which need to be in positions 10 & 11 on the final report.

  10. #10
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Macros - Delete Columns, Cut & Paste Columns then Sorted by Column

    Then add to the list wherever you need them.
    e.g.
    Please Login or Register  to view this content.

  11. #11
    Forum Contributor
    Join Date
    03-05-2015
    Location
    Playa Del Carmen, Mexico
    MS-Off Ver
    2016
    Posts
    111

    Re: Macros - Delete Columns, Cut & Paste Columns then Sorted by Column

    Really really sorry to bother you again but I have been asked for one final change. I need to keep the Notas column (AU) and have it to the far right of the new report. I've added it into the code above but it isn't working. What do I need to change in the remainder of the code. Thank you for this and thank you for your patience.

  12. #12
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Macros - Delete Columns, Cut & Paste Columns then Sorted by Column

    Show me the line that you made the change.

  13. #13
    Forum Contributor
    Join Date
    03-05-2015
    Location
    Playa Del Carmen, Mexico
    MS-Off Ver
    2016
    Posts
    111

    Re: Macros - Delete Columns, Cut & Paste Columns then Sorted by Column

    Please Login or Register  to view this content.

  14. #14
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Macros - Delete Columns, Cut & Paste Columns then Sorted by Column

    MUST be identical.
    Please Login or Register  to view this content.

  15. #15
    Forum Contributor
    Join Date
    03-05-2015
    Location
    Playa Del Carmen, Mexico
    MS-Off Ver
    2016
    Posts
    111

    Re: Macros - Delete Columns, Cut & Paste Columns then Sorted by Column

    Doh ! Thank you so very much kind sir.

+ 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] Remove Columns, Cut and Paste Column, Delete Rows - Macros
    By M12NIX in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 12-07-2015, 03:10 PM
  2. Link columns next to sorted column
    By nicolslavanda in forum Excel General
    Replies: 1
    Last Post: 11-10-2015, 09:55 AM
  3. Replies: 3
    Last Post: 02-06-2015, 05:47 AM
  4. Combining multiple rows from 2 columns into sorted columns depending on 1st columns value
    By Dexamphetamine in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-11-2013, 10:00 AM
  5. Replies: 1
    Last Post: 05-06-2013, 06:28 AM
  6. Replies: 0
    Last Post: 02-22-2013, 09:23 AM
  7. [SOLVED] Multiple columns to individuals columns by sorted column
    By wildlifeduke in forum Excel General
    Replies: 4
    Last Post: 07-27-2012, 05:05 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