ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Add new sheet automatically every data. (https://www.excelbanter.com/excel-programming/428238-add-new-sheet-automatically-every-data.html)

Heera Chavan[_2_]

Add new sheet automatically every data.
 
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

joel

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



All times are GMT +1. The time now is 02:02 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com