Auto resize specific collumns

xyzabc198

Board Regular
Joined
Jul 30, 2008
Messages
126
i want to make collumns 1-14
And 16-32
To Automatically resize to fit in any additional text added
(E.G. collumn 17 currently has 144 in most collumns, but am wanting to change one to 1475963 which will not all be shown in that cell, I want to cell to automatically enlarge to beable to show it all without having to manually resize it by double clicking on the side of the collumn)
is this doable?
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Hmm. this could be done with a worksheet_change macro... however I am still very new to those, so I'm afraid this is as far as I could help you. Perhaps one of the MVPs here can give ya a hand ;)
 
Upvote 0
I hope so because I've not even come across one of them macro's before so I wouldn't have a clue where to start :-(
 
Upvote 0
Someone else will need to jump in on this. This works for me, but I am not sure how to customize it to your request for certain columns.
Sub foo()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
ws.Cells.EntireColumn.AutoFit
Next ws
End Sub<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
 
Upvote 0
Assuming the cells' values will change manually (as opposed to via formula), right click on your sheet tab, select "view code", and put something like this:

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column <= 14 Or (Target.Column <= 32 And Target.Column >= 16) Then
Target.EntireColumn.AutoFit
End If
End Sub
 
Upvote 0
Assuming the cells' values will change manually (as opposed to via formula), right click on your sheet tab, select "view code", and put something like this:

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column <= 14 Or (Target.Column <= 32 And Target.Column >= 16) Then
Target.EntireColumn.AutoFit
End If
End Sub

Excellent, worked perfect, thanks for that matey!
 
Upvote 0

Forum statistics

Threads
1,223,270
Messages
6,171,103
Members
452,379
Latest member
IainTru

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