Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run-time error 13

Status
Not open for further replies.

vba317

Programmer
Mar 5, 2009
708
US
I am writing a loop to loop through all the sheets in my workbook and delete sheets with no information in them. I keep on getting a run time error 13. Any help is appreciated. The name of the workbook is _Assists.xlt. The name of the sheets I want to loop through is Assists_1 through Assists_8

Tom

Code:
    For S = 1 To 8
        For Each ws In Workbooks("_Assists.xlt").Worksheets
            If ws.Name = "Assists_" & S Then ws.Delete
        Next ws
    Next S
 
I don't understand why you are using 2 loops. You are looping from 1 to 8 for each worksheet in the workbook. Why not just do one or the other loop?

Also, the question should have been posted in forum707.

Duane
Hook'D on Access
MS Access MVP
 
Sorry I will post it in the other forum.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top