Is there no way to move table columns and preserve all column widths?

JenniferMurphy

Well-known Member
Joined
Jul 23, 2011
Messages
2,691
Office Version
  1. 365
Platform
  1. Windows
Whenever I had tried to move a table column, the widths of many of the other columns get all messed up. I've tried moving just the table columns (by dragging the table header) and moving the sheet column (by dragging the column header). They each mess up other column widths, but in different ways.

The table I am currently working on is way too large to post as a minisheet. If examples are needed, I can try creating a test table.

This was discussed in this thread about 18 months ago with no solution:


And it referred to this tread in the Microsoft Community, also with no solution:


Is there a way to move columns and preserve all column widths, or is this just another M$FT bug that will be ignored for 20 years?
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Hi Jennifer,

Not sure if I'm missing the issue so apologies in advance. When say move, you mean cut / copy and paste right?

The way I do it is;
- I select the first cell in the original table then drag to select either partial or the whole lot
- then Cut or Copy
- then select the first cell of the new location
- right click - select "paste special"
- click arrow ->
- select second row second option from the left

Then wolla?
 
Upvote 0
I just tested it out, and on my end (office 2019) Excel remembers the widths and adjust the rest of the columns if you select the entire columns then copy/cut and paste. Individual ranges does not retain column widths.

I believed I ran into this issue before a few years back too.

If I remember correctly I wrote a macro that looped each column/row, remembered the width of the origin, created a new column in the desired location and adjusted the width of that column before copying the data over. Doing so pushed all other cells over by one, thus not messing up the original formatting.

But, that was very situational and required legwork every time I used it. Probably not the best solution.
 
Upvote 0
Ok. Here's a little sample sheet. I'll post screen shots of two moves and then the minisheet.

Here's the table as originally created.

1713638525943.png


First, I'll try moving an entire column. I selected the entire Price column (D).

1713638617550.png


Then I dragged that column to the left 1 column. The Comments column gets messed up.

1713638692835.png


Next I'll try moving just a table column. I selected the Comments column in the table.

1713638983739.png


Then I tried dragging that 1 column to the left. Both the Comments and Price columns get messed up.

1713639073234.png


Here's the minisheet.

Tables.xlsx
ABCDE
1NumDateIDPriceComments
214/20/24abc123$9.99This field contains some text
324/03/24xyz999$19.99Here's some more text
433/05/24$29.99And still more and more
Move Columns
 
Upvote 0
I have only found 1 reliable work around that doesn't require a macro.
Your sample data isn't sufficiently representative as the sample needs to contain formulas since some of the workarounds corrupt them.
I also moved the table to B2 to show some distintinction as to what makes up the sheet vs the table.

This is a workaround and therefore requires more steps than is ideal. I chose to remove Qty it impacts the width of more columns.
When we move Column G (qty) to the left of Column D (ID), the Data in Columns D-F will move 1 column to the right but the column widths will not move.
• Move just the "table column" Qty (G) to the left of ID (D)
• In the heading row select columns D-F
• ctrl+C
• right arrow once (move across 1 column)
• PasteSpecial Column Widths (Ctrl+Alt+V w [for widths] ok)
• You will still need to fix the width of the moved column

It might be a little easier to pick the columns to fix the width on if you do that first
ie copy the width from columns D-F to E (which copies to E-G) then move the Qty

Sample data used:

Book1
ABCDEFGHI
1
2NumDateIDPriceCommentsQtytotalMore Cols
3120-Apr-24abc1239.99This field contains some text1099.9abc
423-Apr-24xyz99919.99Here's some more text10199.9def
535-Mar-2429.99And still more and more10299.9zzz
6
Sheet3
Cell Formulas
RangeFormula
H3:H5H3=[@Price]*[@Qty]
 
Upvote 0
I have only found 1 reliable work around that doesn't require a macro.
Your sample data isn't sufficiently representative as the sample needs to contain formulas since some of the workarounds corrupt them.
I also moved the table to B2 to show some distintinction as to what makes up the sheet vs the table.

. . .
Wow. I'm not sure I completely follow your workaround. I guess I'll just move the columns and then readjust the widths.

So this is a known bug?
 
Upvote 0
In principle the column width is a property of the sheet and not of the table.
So moving columns in the table does not move the column widths with it since the column width is attached to the Sheet's column which hasn't moved.

So based on the above in theory it should work better to move entire columns but then it impacted columns to the right of the moved column.
Writing this has prompted me to see if something similar to the above would work and it does seem to. The impact is then to the columns to the right of the moved column.

I added more columns to the sample below because I was finding it difficult to see what moved to where.
Moving Qty (now col H) to before ID col D
• The next column is total (Col I) - click in the header of that column
• ctrl+shift+right arrow (select to end)
- this is probably easier than the previous method which impacted columns between where is was and where it was moved to
• ctl+C
• left arrow (move 1 column to the left)
• PasteSpecial Column widths (ctrl+alt+v then w [column width] ok(
• Select entire column (whole sheet) for Qty (col H)
• shift drag the Qty column to ID (col D)
• fix Qty Col width

Note: It seems inconsistent in the way it treats data that is not in a table but under the table. It moved the data in the column as you would expect but then leaves a gap where the data was, which doesn't make sense given we moved the entirecolumn. That is not how it works had the table not been above it.

Sample data

20240421 ListObject Tables Move Column column width JenniferMurphy v02.xlsx
ABCDEFGHIJKL
1
2NumDateIDPriceCommentsMore Cols another colQtytotalMore Cols2More Cols22More Cols222
3120-Apr-24abc1239.99This field contains some textabc1099.9abcabcabc
423-Apr-24xyz99919.99Here's some more textdef10199.9defdefdef
535-Mar-2429.99And still more and morezzz10299.9zzzzzzzzz
Final
Cell Formulas
RangeFormula
I3:I5I3=[@Price]*[@Qty]
 
Upvote 0
In principle the column width is a property of the sheet and not of the table.
So moving columns in the table does not move the column widths with it since the column width is attached to the Sheet's column which hasn't moved.

. . .

Ok, I think I see your point about column widths belonging to the table vs the sheet. And I can see how moving just the table columns can present Excel with a dilemma. But the current implementation is. IMNSHO, illogical, inconsistent, and, frankly, STUPID. If the widths belong to the sheet, then moving a sheet column ought to preserve all widths. That's what happens if a table is not involved. What possible rationale could there be for the current behavior?
 
Upvote 0
It does appear that in trying to give Tables a life of its own, they introduced some inconsistent behaviour.
It makes me wonder if they do any real testing. Don't they have Alpha Test and Beta Test teams? Maybe they should post new releases here and let the amazingly talented spreadsheet experts here take a whack at 'em.

Maybe the solution is to change tables from the half-baked, half independent life that they have now to a fully independent life. Make them "float" over the sheet like Text Boxes. Then changes to the tables would not affect the sheet and vice versa. And that would make multiple tables easier to manage.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,176
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top