Put ALL of this in your ThisWorkbook module. Change sheet2 to your sheet
name. Fire the setwhichmonth to test or reset.
'============
Public whichmonth
Sub setwhichmoth()
whichmonth = 1
End Sub
'=========
Sub workbook_open()
On Error GoTo endit
If Month(Date) > whichmonth Then nm = Month(Date)
If DateSerial(Year(Date), nm, 1) >= _
Application.Run("ATPVBAEN.xla!Workday", nm - Day(nm), 1) Then
With Sheets("sheet2").Range("k12")
.Value = .Value + 100
End With
whichmonth = Month(Date)
End If
endit:
End Sub
'=======
--
Don Guillett
SalesAid Software
(E-Mail Removed)
<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> A12 = Microsoft
>
>
> O12 = the market value of my microsoft shares.
> M12 = the number of Microsoft shares I currently own
> N12 = the current price of each share.
> G12 = the amount of money I invest into Microsoft each month ...
> always the same monthly investment
> H12 = the day of the month (call it the 1st) that I make the monthly
> investment .... always the same day .... unless it is not a business
> day
>
> I need a formula or macro that would re-calculate cell M12 after I
> make each monthly investment.
>
>
> Summary.... on May 31st, I owned 4000 Microsoft shares. On the 1st I
> bought 100 more. I need M12 to update to 4100 when I run the macro.
> Can the macro be programmed to run only once each month?
>