I would like to write a macro that would create a workshee
automatically for the next year but how can i prevent it from creatin
a new worksheet everytime the macro is run.
i have work out some codes but i think it still need alot o
improvements.
i would need the program to create a worksheet for 2007 if today's yea
is 2006. which means the name of the worksheet would be next year.
Dim x As Integer
x = 2006
Workbooks("PEM_Master_Record.xls").Activate
If Year(Date) = x Then
Dim y As Worksheet
On Error Resume Next
Set y = Sheets([text(today(),"yyyy")])
If Err.Number = 0 Then Exit Sub
Application.ScreenUpdating = False
Set y = ActiveWorkbook.Worksheets.Add(after:=Sheets(Sheets .count))
y.Name = [text(today(),"yyyy")]
Application.ScreenUpdating = True
Set y = Nothing
End I
--
ReD-DevI
-----------------------------------------------------------------------
ReD-DevIL's Profile:
http://www.excelforum.com/member.php...fo&userid=3262
View this thread:
http://www.excelforum.com/showthread.php?threadid=52560