ravikumar00008
New Member
Hi All,
I am able to find out the current month and previous month by using this code and it is fine.
[pre]
[/pre]
If i want to find all the previous months sheets from the current month along with the current month.How i need to change the code.
Please help me to solve this problem
ex:
CurrMonth=July
PrevMonths=June,May,April,March,Feb,Jan.
Regards
Kumar
I am able to find out the current month and previous month by using this code and it is fine.
[pre]
Code:
Dim CurrMonth, PrevMonth, ws As Worksheet, x
CurrMonth = Format$(Date, "mmm")
PrevMonth = Format$(Date - Day(Date), "mmm")
For Each ws In Sheets
If ws.Name Like CurrMonth & "*" Then
CurrMonth = ws.Name
ElseIf ws.Name Like PrevMonth & "*" Then
PrevMonth = ws.Name
End If
Next
Sheets(CurrMonth).Select
Sheets(PrevMonth).Select
If i want to find all the previous months sheets from the current month along with the current month.How i need to change the code.
Please help me to solve this problem
ex:
CurrMonth=July
PrevMonths=June,May,April,March,Feb,Jan.
Regards
Kumar