Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I would like to AutoFit all the columns in the UsedRange of a worksheet
unless that would make the column wider than 40. In that case I want to set the column to 40. I get an Object Required error 424 message when I attempt the following: Sub SetColWidth() Dim col As Range Cells.EntireColumn.AutoFit For Each col In UsedRange If col.ColumnWidth 40 Then col.ColumnWidth = 40 End If Next End Sub I just want to automate a report that my predecessor did manually. Could anyone supply me with a brief explanation of the mistake I've made? I'd like to avoid it in the future. Thanks in advance for any help. -- tj |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Change Cell Width WITHOUT changing Column width | Excel Discussion (Misc queries) | |||
how do I create multiple column width in the same column in excel | Excel Discussion (Misc queries) | |||
How to make cell width different than the column width it lies in | Excel Discussion (Misc queries) | |||
Change the width of a single column in a column chart | Charts and Charting in Excel |