Hi, this should solve your problem:
Option Explicit
Sub SheetAdd()
Dim x As String
On Error GoTo line1:
x = DatePart("yyyy", Date)
x = x + 1
Sheets(x).Select
Exit Sub
line1:
Worksheets.Add.Move after:=Worksheets(Worksheets.Count)
ActiveSheet.Name = x
End Sub
Henrich
€žHenrich" napÃ*sal (napÃ*sala):
Hi, so use this:
x = DatePart("yyyy", Date)
Henrich
€žReD-DevIL" napÃ*sal (napÃ*sala):
Hi, thanks a lot for your help. But instead of giving "x" a fixed value,
can we have a condition that once every first day of a new year it will
automatically create a new worksheet. e.g. today is 01/01/06 then a new
worksheet named 2007 is created, then once it is 01/01/07 a worksheet
for 2008 will be added. Is that possible ?
--
ReD-DevIL
------------------------------------------------------------------------
ReD-DevIL's Profile: http://www.excelforum.com/member.php...o&userid=32624
View this thread: http://www.excelforum.com/showthread...hreadid=525600