View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Alan Alan is offline
external usenet poster
 
Posts: 492
Default Does a worksheet exist?

Hi All,
I have a file that records defects on a fleet of vehicles with a macro in it
which produces a list of repeat defects in the last 28 days on demand when
the vehicle comes up for servicing..
This macro names the worksheet as the name of the vehicle, for arguments
sake, call it 'Truck25'.
Sometimes a user will invoke this macro when a worksheet called 'Truck25'
already exists.
I've used the error handler facility within the macro code to pop up a
message box to inform the user that the sheet name already exists, delete
the new sheet and exit the sub.
I need to give some kind of warning that the macro wont work because the
people that use it are not computer buffs, just exiting generates a lot of
phone calls!
My question is, is there any way to determine whether a sheet named
'Truck25' exists already? If so I can modify the code to delete it before
another one is created and thus avoid the error and the need for a message
box,
TIA,
Regards,
Alan.