Please could someone suggest VBA code to do the following:
I have a Workbook Called "SALES".
I want to create a yearly worksheet but obviously only if it doesn't exist.
So if for example it was January 2006 then i want to check in the active workbook, called "SALES", for the existance of a worksheet called "2006". If it doesn't exist i want to create one named "2006", if it does exist then i don't need to create it.
Also how do i then after making the worksheet, how do i then call it to apply some VBA. I need to check for the year and then set this to a string called "CurrentYear". Bear in mind that a worksheet "2005" exists so to access this worksheet i would hope that "CurrentYear" will equal "2005". Whereas if it is January 2006 i hope that "CurrentYear" will equal "2006" and so on and so forth.
I assume it will be similar to this :
With Workbook("SALES).Worksheets(CurrentYear).
' Code here
End with
But i am not sure !!!
Please advise.
I have a Workbook Called "SALES".
I want to create a yearly worksheet but obviously only if it doesn't exist.
So if for example it was January 2006 then i want to check in the active workbook, called "SALES", for the existance of a worksheet called "2006". If it doesn't exist i want to create one named "2006", if it does exist then i don't need to create it.
Also how do i then after making the worksheet, how do i then call it to apply some VBA. I need to check for the year and then set this to a string called "CurrentYear". Bear in mind that a worksheet "2005" exists so to access this worksheet i would hope that "CurrentYear" will equal "2005". Whereas if it is January 2006 i hope that "CurrentYear" will equal "2006" and so on and so forth.
I assume it will be similar to this :
With Workbook("SALES).Worksheets(CurrentYear).
' Code here
End with
But i am not sure !!!
Please advise.