Thread: multiple sheets
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Bill Renaud Bill Renaud is offline
external usenet poster
 
Posts: 417
Default multiple sheets

Try setting up your code to be more like the following. (This is not
totally tested. There are still some errors in your For loop that I can't
debug without knowing your data better. Also, be careful. The SpecialCells
property may fail, if there are no formulas!)

'----------------------------------------------------------------------
Public Sub FormatAllWorksheets()
Dim ws As Worksheet

Application.ScreenUpdating = False

For Each ws In Worksheets
FormatWorksheet ws
Next ws
End Sub

'----------------------------------------------------------------------
Sub FormatWorksheet(ws As Worksheet)
Dim cell As Range

With ws
.Name = .Range("e61").Value
End With

With ws.UsedRange
.Rows.Hidden = False
For Each cell In .Columns("h").SpecialCells(xlCellTypeFormulas)
If cell.Text = "dlt" Then cell.EntireRow.Hidden = True
Next cell
End With
End Sub

--
Regards,
Bill Renaud