Autofit / Remove formats VBA Code

  • Thread starter Thread starter Curt J
  • Start date Start date
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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top