Cell Size not moving after selecting Slicer Option

ryan7

Board Regular
Joined
Apr 30, 2020
Messages
84
Office Version
  1. 2016
Platform
  1. Windows
I have a table with over 4000 rows and 26 columns.
Often, I need to sort/re-sort. I have overlapping text wrapped however when I change the order of some columns it does not always change the row height therefore looks a bit silly.

Is there a fix to this?
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
I have a table with over 4000 rows and 26 columns.
Often, I need to sort/re-sort. I have overlapping text wrapped however when I change the order of some columns it does not always change the row height therefore looks a bit silly.

Is there a fix to this?
Hi Ryan,
This should do the trick, this will autofit the rows and columns anytime something is changed in the worksheet. Put this code in the worksheet where your table exists, change the sheetname in the code to your sheet name. This will only run when something actually changes in the worksheet.

VBA Code:
Private Sub worksheet_change(ByVal Target As Range)
Worksheets("Sheet1").UsedRange.EntireColumn.AutoFit
Worksheets("Sheet1").UsedRange.EntireRow.AutoFit
End Sub

Alternatively, you can add a button to the sheet, for auto fit to be executed after a manual sort.

VBA Code:
Worksheets("Sheet1").UsedRange.EntireColumn.AutoFit
Worksheets("Sheet1").UsedRange.EntireRow.AutoFit

I don't think a worksheet change can detect when a manual sort has been done, unfortunately. I could be wrong though.
 
Upvote 0

Forum statistics

Threads
1,215,235
Messages
6,123,779
Members
449,123
Latest member
StorageQueen24

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