Use the Date and Year VBA functions, as in:
Sub showyear()
myYear = Year(Date)
MsgBox myYear
End Sub
Of course, for 2009 this year you could use:
myYear = Year(Date) +1
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
www.stfx.ca/people/bliengme
remove caps from email
"mohavv" wrote in message
...
Is there a way to use the current year in a a macro?
I have the following code (partially):
Set wkbk = Nothing
On Error Resume Next
Set wkbk=Workbooks("08Bud 0770.xls")
On Error GoTo 0
If wkbk = Nothing then
Set wkbk = Workbooks.Open(Filename:"=P:\Excel\2008\08Bud 0770.xls"
etc
This repeats several times for different files
Now I want to copy the file for budget 2009 and all other sub files,
changing only the year number.
I want, without somebody opening VBE, the macro to work in the new
file to.
Any suggestions?
Cheers,
Harold