![]() |
Macro to delete worksheets
I have a workbook that has almost 600 tabs, but only about 200 have data that I need. Can anyone help me write a macro that check the value of a certain cell, say W300, and deletes each worsheet where it equals zero? thanks -- rbanks ------------------------------------------------------------------------ rbanks's Profile: http://www.excelforum.com/member.php...fo&userid=2944 View this thread: http://www.excelforum.com/showthread...hreadid=521753 |
Macro to delete worksheets
Hi, just off the top of my head this is what I got: Code: -------------------- Public Sub Main() For i = 1 To Sheets.Count If TypeName(Sheets(i)) = "Worksheet" Then Sheets(i).Activate If ActiveSheet.Cells(Y, X).Value = "" Then Application.DisplayAlerts = False ActiveSheet.Delete Application.DisplayAlerts = True End If End If Next End Sub -------------------- Not tried the code, perhaps someone else knows a better way? -- gti_jobert ------------------------------------------------------------------------ gti_jobert's Profile: http://www.excelforum.com/member.php...o&userid=30634 View this thread: http://www.excelforum.com/showthread...hreadid=521753 |
All times are GMT +1. The time now is 07:33 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com