View Single Post
  #1   Report Post  
oranskeer
 
Posts: n/a
Default Automatic Autofit

I have the following code for each sheet in my workbook to make the cells
grow with the data entered automatically:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Intersect(Target(1, 1), [A:A]) Is Nothing Then Exit Sub
Target(1, 1).EntireColumn.Autofit
End Sub

All of a sudden, it just stopped working and now I get an error whenever I
click on one of the cells:

Run-time error '1004'
AutoFit Method of Range class failed

When I press debug it takes me to the line Target(1, 1).EntireColumn.Autofit

Any suggestions?

Thanks in advance!