View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Add new sheet automatically every data.

You have to change the FORMAT statement below to match the method you are
naming the worksheet.


Sub test()

ShtName = Format(Date, "mm_dd_yy")
Found = False
For Each sht In Sheets
If sht.Name = ShtName Then
Set TodaySht = sht
Found = True
Exit For
End If
Next sht
If Found = False Then
Sheets.Add after:=Sheets(Sheets.Count)
Set TodaySht = ActiveSheet
TodaySht.Name = ShtName
End If


End Sub


"Heera Chavan" wrote:

Hi all,

I have four users and everyone update some information in a sheet and runs a
macro to update that information in a centerlized database sheet.

Now my problem is every day i have to add a new-sheet (Sheet Name is Todays
Date) manually in the database sheet which i want to avoid.

I dont know how to write a code which will detect todays date sheet if it is
not there it should create it automatically. I just to add this code in my
macro.

Regards
Heera