Hi everybody
I have a strange request!!
Is there a code to know the date when a worksheet is created??
Hi everybody
I have a strange request!!
Is there a code to know the date when a worksheet is created??
This should record the creation in Sheet 3. It assumes 3 original sheets. Place in ThisWorkbook module
[VBA]
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
If Right(Sh.CodeName, Len(Sh.CodeName) - 5) > 3 Then
Sheet3.Cells(Rows.Count, 1).End(xlUp)(2) = Sh.CodeName
Sheet3.Cells(Rows.Count, 2).End(xlUp)(2) = Now
End If
End Sub
[/VBA]
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
Thanks a lot Mr. mdmackillop
I want to record the name of the sheet not the code name...
Another thing ::what about existing worksheet , is there any way to record when they were created??
I'm sure you can work that out for yourself.I want to record the name of the sheet not the code name...
You could save in the "log" when the workbook was created. I know of no way to retrospectively obtain sheeet creation data.Another thing ::what about existing worksheet , is there any way to record when they were created??
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
You need to use the workbook event Workbook_Newsheet, put this in the ThisWorkbook code module as a demo, add/insert a new sheet and you get a message, you should then be able to adapt it
[VBA]Private Sub Workbook_NewSheet(ByVal Sh As Object)
MsgBox Sh.Name & " was created " & Now
End Sub[/VBA]
Regards,
Simon
Please read this before cross posting!
In the unlikely event you didn't get your answer here try Microsoft Office Discussion @ The Code Cage
If I have seen further it is by standing on the shoulders of giants.
Isaac Newton, Letter to Robert Hooke, February 5, 1675 English mathematician & physicist (1642 - 1727)