Dummy Excel
Well-known Member
- Joined
- Sep 21, 2005
- Messages
- 1,004
- Office Version
- 2019
- 2010
- 2007
- Platform
- Windows
Hi All,
I'm going crazy trying to get this logic right...
I have a report that needs to be done monthly. The macro finds the previous month, opens it and copies the data into my new report for history. The problem im having is come Jan 11, its looking for the previous report as Dec 11.
Scenario for the predefined Values are:
So my question is how can I make the "11" (in bold) dynamic so come 2012, I don't need to make any changes?
thanks in advance
Samuel
I'm going crazy trying to get this logic right...
I have a report that needs to be done monthly. The macro finds the previous month, opens it and copies the data into my new report for history. The problem im having is come Jan 11, its looking for the previous report as Dec 11.
Scenario for the predefined Values are:
Code:
YY 11
PreYY 10
CurMnth Jan
PriorMnth Nov
PreMnth Dec
Customer ABC
Business XYZ
Rich (BB code):
If YY = "11" And CurMnth = "Jan" And PreMnth = "Dec" Then
Windows(Customer & " " & Business & " OF " & PriorMnth & " " & PreYY & ".xls").Activate
Else
Windows(Customer & " " & Business & " OF " & PriorMnth & " " & YY & ".xls").Activate
End If
So my question is how can I make the "11" (in bold) dynamic so come 2012, I don't need to make any changes?
thanks in advance
Samuel