Add new sheet automatically every data.

H

Heera Chavan

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
 
J

joel

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top