D
DarkNight
Hello, i need to find out what the o.s. year is in vba so that i can delete
tab on a sheet.
my sheet has several tab, some which i don't want to delete like "ledger"
"2008" and the current year "2009" if i add extra years i would like to be
able to delete years "2010" + i have some code wich add the years to my
sheet which basicaly copys previous years and clears all the contents and
renames it to the next year, in doing so it all so adds various totals to my
"ledger" sheet.
For Each sh In Sheets
If sh.Name = "Ledger" Then GoTo skip
If sh.Range("A1").Value > NewYear Then _
NewYear = sh.Range("A1").Value
skip:
Next sh
'Select Lastest Year
Nsh = CStr(NewYear)
'''' change this year every year '''
If Nsh = "2008" Then End
''''''''''''''''''''''''''''''''''''
Sheets(Nsh).Select
'Add and rename new sheet
Worksheets(Nsh).Delete
so its this line if Nsh = "2008" then end that i need to auto update.
please help, thanks in advance
tab on a sheet.
my sheet has several tab, some which i don't want to delete like "ledger"
"2008" and the current year "2009" if i add extra years i would like to be
able to delete years "2010" + i have some code wich add the years to my
sheet which basicaly copys previous years and clears all the contents and
renames it to the next year, in doing so it all so adds various totals to my
"ledger" sheet.
For Each sh In Sheets
If sh.Name = "Ledger" Then GoTo skip
If sh.Range("A1").Value > NewYear Then _
NewYear = sh.Range("A1").Value
skip:
Next sh
'Select Lastest Year
Nsh = CStr(NewYear)
'''' change this year every year '''
If Nsh = "2008" Then End
''''''''''''''''''''''''''''''''''''
Sheets(Nsh).Select
'Add and rename new sheet
Worksheets(Nsh).Delete
so its this line if Nsh = "2008" then end that i need to auto update.
please help, thanks in advance