+ Reply to Thread
Results 1 to 4 of 4

[Excel 2013] Columns of a table shifting to the left

  1. #1
    Registered User
    Join Date
    01-25-2018
    Location
    Quebec, Canada
    MS-Off Ver
    2013
    Posts
    16

    [Excel 2013] Columns of a table shifting to the left

    Hi,

    I have a question concerning the formatting of a table :

    In this table :
    1) In B12:M12, in each cell, are the months of the year.

    2) B12 has a drop down menu also with the months of the year.

    3) Under each columns of de B12:M12, that is B13:B18 are values corresponding to the month.

    4) I'm desperately looking for a way to, let say, if I select a month, February in the drop down, the values of february will shift from B13 to B12.

    5) B13 will now show the values of March in cells bellow.

    6) So, we can see that there's a shift of columns to the left.

    The table must :

    7) retain the same number of columns, i.e. 14;

    8) If i select, February in the drop down, January will go right to the end of the table.
    Example :
    February March April May June ... December January
    It's a carrousel like type of table. Get the picture ?

    Here's a file showing what I'd like to do.

    Thank you for your much appreciated answers ,

    Camaalot
    Last edited by Camaalot; 04-23-2018 at 12:22 PM.

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: [Excel 2013] Columns of a table shifting to the left

    Cell K3 has the drop down values for the month and it is a named cell. If you want it somewhere else, CUT and paste it there.

    The macro is called ShiftColumns and it works by splitting the existing range into two parts: the part to shift to the front, and the part to rotate to the end. Since Excel only has one clipboard, I had to copy these parts to a temporary area (starting in row 24) and copy and paste this back to the original range. Then go back and clear out the temporary range.

    So, if you intend on putting other things on this sheet, be aware of that. If you need this space, then a minor change to the code can be made.
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  3. #3
    Registered User
    Join Date
    01-25-2018
    Location
    Quebec, Canada
    MS-Off Ver
    2013
    Posts
    16

    Re: [Excel 2013] Columns of a table shifting to the left

    Hi dflak,

    Thanks for the time spent on my project.

    One thing, the vba you wrote does nothing !!

    Is it me or what ?

    Thanks again,

    Camaalot

  4. #4
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: [Excel 2013] Columns of a table shifting to the left

    Make sure you have the macros enabled.

    Here is a version with a button to shift the months. If you select January, nothing will happen. If you select any other month, the shift should happen.

+ 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] Extracting Data from Word Table to Excel 2013 into specific columns
    By achieve1 in forum Word Programming / VBA / Macros
    Replies: 3
    Last Post: 03-16-2017, 12:41 AM
  2. Pasting table from Excel 2013 to Word 2013 with VBA
    By simonlevey in forum Word Programming / VBA / Macros
    Replies: 3
    Last Post: 06-20-2016, 02:58 PM
  3. Replies: 10
    Last Post: 09-15-2015, 04:53 PM
  4. Excel 2013 and Access 2013 as Pivot Table External Data Source
    By Grimnebulin in forum Access Tables & Databases
    Replies: 1
    Last Post: 05-27-2015, 02:13 PM
  5. Replies: 0
    Last Post: 06-09-2014, 07:24 PM
  6. Add and Delete table columns without cells shifting?
    By brucemc777 in forum Excel General
    Replies: 3
    Last Post: 05-19-2014, 05:50 PM
  7. Stopping Excel Table from shifting other rows/columns
    By NortheasternStudent in forum Excel General
    Replies: 1
    Last Post: 08-12-2013, 01:41 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