From: Max on
I'm looking for a way to keep track of the number of times that a sub is run
(via the press of a forms button) and to write that number into a cell on the
sheet, say into G1. If the button is pressed 10x, then G1 will read: 10.
Thanks
From: ozgrid.com on
Sub MyMacro()
If Application.Caller = "Button 1" Then
Sheet1.Range("G1") = Sheet1.Range("G1") + 1
End If

'YOUR CODE
End Sub



--
Regards
Dave Hawley
www.ozgrid.com


"Max" <demechanik(a)yahoo.com> wrote in message
news:56E00F52-ED7A-49A5-9EC9-1ACDCE89B504(a)microsoft.com...
> I'm looking for a way to keep track of the number of times that a sub is
> run
> (via the press of a forms button) and to write that number into a cell on
> the
> sheet, say into G1. If the button is pressed 10x, then G1 will read: 10.
> Thanks