Delete Tab Formula Problem

  • Thread starter Thread starter greengrass
  • Start date Start date
G

greengrass

I am having problem with the following code. A member was nice of
enough to provide the following:

Sub DeleteTabs()
On Error Resume Next
Application.DisplayAlerts = False

For Each x In Worksheets
If IsEmpty(x.UsedRange) Then x.Delete
Next x

Application.DisplayAlerts = True

End Sub

I thought using searchs and such I would be able to figure out how to
make this work, wrong, so here I am looking for some again.

What I am trying to do is delete unsed worksheets in a single workbook.
The workbook has 20 worksheets but not all sheets are used all the time
and I would like to delete the extra sheets. All sheets have same
number of rows, columns, so, if cell f286 = 0 delete sheet and go to
next sheet etc.

Any help for this newbie would be great!

Thanks,
 
Hi,

I guess you could try this :
Sub DeleteTabs()
On Error Resume Next
Application.DisplayAlerts = False

For Each x In Worksheets
If x.cells(286,6)=0 Then x.Delete 'this tests cell F286
Next x

Application.DisplayAlerts = True

End Sub

Cheers,

Didier
 
Back
Top