Hi Guys,
There are two columns in a spreadsheet, Column A is Document Date, Column B is Document Period.
There are already dates in Column A. (There could be as many as 2000 dates in Column A)
How can I write a VBA code so that the output in Column B would be:
The rules are:
1. Add one more month in Column B. For example, Cells(A2) = 5/9/2011, add one month to May( means June), Cells(B1) = 06/2011. Note that there is an additional '0' before 6, and there is no day value(only month and year in this case).
2. If the year in Column A is 2012, don't put year value in Column B. If the year value in Column is not 2012, put the year value in Column B. For example, Cells(A2) = 5/9/2011, it's Year 2011, not 2012. So put year 2011 in Column B, and Cells(B1) = 06/2011. However, Cells(A3) = 4/18/2012, it's Year 2012. So just put '05' in the next column without '/2012'.
3. If it's blank in Column A, leave it blank in Column B.
Any suggestion is welcomed!