Posted to microsoft.public.excel.programming
|
|
Cell Change activating macro. How do you make it happen?
I not intersect(Target,Range("F5:F6")) is nothing then
End if
--
Regards,
Tom Ogilvy
John Baker wrote in message
...
Guys:
I am embarrassed to ask this, but here goes.
The suggestions you all have made work magnificently, but I have found
that there are TWO
cells that need to trigger the SAME macro when they change (the month and
the year). I
tried putting in a second copy of the macro in on the worksheet level,
pointing to the
second cell, but it complained that it was a duplicate name (quite
justly). I tried
various combinations to refer to the two cells F5 and F6, but none of them
worked.
How do I refer to two adjacent cells in the formula you gave me?
Thanks again
John Baker
(Richie UK) wrote:
Hi John,
Right-click on the sheet tab in question and select 'View Code'. In
the VBE paste in the following code:
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Address < "$A$1" Then Exit Sub
Call ARoutine
End Sub
And in a general module (eg Module1) paste the routine to be called:
Sub ARoutine()
MsgBox "Your macro here!"
End Sub
Just change the A1 reference to the cell of your choice and amend
ARoutine to the routine in question.
HTH
Richie
John Baker wrote in message
. ..
Hi
I have a situation where I would like to activate a macro after a
change in the contents
of a single cell. I know that this can be done for applications and
worksheets, but can
someone tell me how to make it happen for a single cell. Note that I am
not very good at
VBA coding, so any details would be helpful.
Thanks
John Baker
|