ravikumar00008
New Member
Hi,
if the workbook sheet names are like this "Jan '12"....."Jun '12","Jul '12"..etc
I am using this code to find out the current month and previous month sheets in my workbook
[pre]
[/pre]
If the workbook sheet names are like this "Jan '12","Feb '12","Mar '12","April '12","May '12","June '12","Jul '12","Aug '12","Sept '12","Oct '12","Nov '12",
"Dec '12"
see these are not in the same format.
Now how to find the current month and previous month sheets from this kind of workbook.
Thanks in advance.
Regards
Kumar
if the workbook sheet names are like this "Jan '12"....."Jun '12","Jul '12"..etc
I am using this code to find out the current month and previous month sheets in my workbook
[pre]
Code:
sub test()
Dim CurrMonth As String, PrevMonth As String
CurrMonth = Format$(Date, "mmm 'yy")
PrevMonth = Format$(Date - Day(Date), "mmm 'yy")
sheets(CurrMonth).select
msgbox "current month",,currmonth
sheets(prevmonth).select
msgbox "previous month",,prevmonth
end sub
If the workbook sheet names are like this "Jan '12","Feb '12","Mar '12","April '12","May '12","June '12","Jul '12","Aug '12","Sept '12","Oct '12","Nov '12",
"Dec '12"
see these are not in the same format.
Now how to find the current month and previous month sheets from this kind of workbook.
Thanks in advance.
Regards
Kumar