Option Explicit
Public Sub AutoFitSheet()
If ActiveWorkbook Is Nothing Then Exit Sub
Dim i
If ActiveWindow.SelectedSheets.Count > 1 Then
For i = 1 To ActiveWindow.SelectedSheets.Count
ActiveWindow.SelectedSheets(i).Cells.EntireColumn.AutoFit
Next
Else
Cells.EntireColumn.AutoFit
End If
End Sub
Sub test()
Set A = Range("A1:A5").Find("*")
If A Is Nothing Then MsgBox ("vide") Else MsgBox "rempli"
End Sub