Select/AutoFit Column


Posted by Dwight on March 16, 2001 8:03 AM

I would like to enhance a previously created macro by adding commands that will:
1. Select the entire column containing the cell that is selected b4 running the macro and,
2. "autofitting" the width of a column which (later in the macro) has already been selected. For this latter, I tried inserting "EntireColumn.AutoFit" but got error message "Run Time Error 424, Object Required.
Can you help?

Posted by Dave Hawley on March 16, 2001 3:01 PM


Hi Dwight

Sub TryThis()
Sheets("Sheet1").Range("B4").EntireColumn.AutoFit
End Sub

Sub TryThis2()
Sheets("Sheet1").Range("B4").EntireColumn.Select
End Sub

OzGrid Business Applications

Posted by Dave Hawley on March 16, 2001 3:02 PM

Or this

Sub TryThis3()
Selection.EntireColumn.AutoFit
End Sub
OzGrid Business Applications



Posted by Dwight on March 19, 2001 9:44 AM

Works Great! Thanks, Dave!