Here is your code:
Sub ComputeSales()
Dim myMonth As Long
myMonth = Month(Date)
ThisWorkbook.Worksheets(2).Range("B1") = _
ThisWorkbook.Worksheets(2).Range("A" & myMonth - 2) - _
ThisWorkbook.Worksheets(2).Range("A" & myMonth - 1)
End Sub
losmac
Użytkownik "slc" napisał w wiadomości
...
I am trying to create a macro to compute the sales figures difference
between month. A1 to A12 cell contain the sales figure for Jan to Dec.
B1 cell contains the difference between the last 2 months.
So in the month of Oct, I want B1 to contain +A9-A8 i.e. the diff
between Sep and Aug after running the macro.
In the next month Nov, I want B1 to contain +A10-A9 and so on.
Anyone have any idea how I can create this macro to. Thanks for your
help in advance.
------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/