Autofit / Remove formats VBA Code

C

Curt J

I would like the code for a macro that autofits and removes any wrap text or
merged cells formats to every sheet in a workbook that does not have a
colored tab.

Is this possible?

Thanks,

Curt J
 
D

Don Guillett

Sub foreachcoloredtab()
For Each ws In ThisWorkbook.Worksheets
If ws.Tab.ColorIndex < 0 Then
'MsgBox ws.Name
With ws.Cells
.WrapText = False
.MergeCells = False
.Rows.AutoFit
.Columns.AutoFit
End With
End If
Next ws
End Sub
 
Top