View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ron5440 Ron5440 is offline
external usenet poster
 
Posts: 16
Default Rename sheet if current sheet name exists

A report is run from a web app.
My program opens the report and formats it.
I want to keep history so new sheets are added each time and named with
todays date.
The problem of course is if it is run twice in one day it crashes as it
tries to create the 2nd sheet with the same name.
I need something to the effect of: (Rdate is a mem var with my formatted date)
x=0
loop:
x=x+1
If a sheet named Rdate [currently exists] then
Rdate = Rdate & " (x)"
go to loop
else
activesheet.name = Rdate