i have no such credentials, and i generally agree. but there are times using an
error to your advantage just makes sense. for example, when adding elements to a
collection. bob's example looks pretty benign to me, too.
--
Gary
"Joel" <(E-Mail Removed)> wrote in message
news:5F9F0417-227C-42CB-AA37-(E-Mail Removed)...
>I have a Master in Computer Science and havve been working for over 25 years.
> I'm serious about GOOD Programming Practices!
>
> "Bob Phillips" wrote:
>
>> Don't be silly!
>>
>> --
>> HTH
>>
>> Bob
>>
>> (there's no email, no snail mail, but somewhere should be gmail in my addy)
>>
>> "Joel" <(E-Mail Removed)> wrote in message
>> news
E197322-DC41-4F28-9D20-(E-Mail Removed)...
>> > Errors should be reserved for Errors, not in place of good programming
>> > practices. Good programming practrices should not force an error on a
>> > normal
>> > condition. Errors should be reserved for abnormal condtions.
>> >
>> > "Bob Phillips" wrote:
>> >
>> >> No need to loop
>> >>
>> >> Application.DisplayAlerts = False
>> >> On Error Resume Next
>> >> Worksheets("Rejected Voucher Statistics").Delete
>> >> On Error GoTo 0
>> >> Application.DisplayAlerts = True
>> >>
>> >>
>> >>
>> >>
>> >> --
>> >> HTH
>> >>
>> >> Bob
>> >>
>> >> (there's no email, no snail mail, but somewhere should be gmail in my
>> >> addy)
>> >>
>> >> "Joel" <(E-Mail Removed)> wrote in message
>> >> news:7CDB38D1-C978-4D44-8536-(E-Mail Removed)...
>> >> > Sub test1()
>> >> >
>> >> > For Each wks In Worksheets
>> >> >
>> >> > If wks.Name = "Rejected Voucher Statistics" Then
>> >> > wks.Delete
>> >> > End If
>> >> > Next wks
>> >> >
>> >> > End Sub
>> >> >
>> >> > "LabrGuy Bob R" wrote:
>> >> >
>> >> >> Hello, I have this listed in my code and it works fine when I remember
>> >> >> to
>> >> >> delete the sheet and it can be replaced. However there are times I
>> >> >> don't
>> >> >> succeed in getting to that place and hope I can get an answer.
>> >> >>
>> >> >> If the "Rejected Voucher Statistaics" sheet exists I need to delete
>> >> >> the
>> >> >> sheet from the workbook so the new "Pivot Table Sheet" can be moved
>> >> >> seemlessly and named the same. I would like to
>> >> >> 1. Iheck and see if it exists
>> >> >> 2. If it doesn't continue
>> >> >> 3. If it does exist, delete it and continue with the macro..
>> >> >>
>> >> >> ActiveSheet.Name = "Rejected Voucher Statistics"
>> >> >>
>> >> >> Thanks BOBR
>> >> >>
>> >> >>
>> >> >>
>> >>
>> >>
>> >>
>>
>>
>>