Activate a Macro With Only One Clic


Posted by oeloel on August 04, 2000 8:52 PM

Please help me on this: I want to activate a macro with one clic in a specific cell. I also have heard of running a macro with two clics in a cell. I’ll appreciate if anybody comes up with an explanation on the two ways. Thanks in advance.

Posted by Ivan Moala on August 05, 0100 3:07 AM


One click in a specific cell means Activating
that cell so you should lool @ sheet event handlers
eg Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)

Look up online help for this, the key to this
being able to use the Target = your cell to activate the macro.


HTH

Ivan



Posted by Ivan Moala on August 05, 0100 6:11 AM

Here is an example of triggering a macro when
it is in the named range = Totals sales


Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Dim TtlSales As Range
Dim TriggerRg As Range

Set TtlSales = Range("Total_Sales")
Set TriggerRg = Application.Intersect(Target, TtlSales)
If TriggerRg Is Nothing Then End

If TriggerRg.Areas.Count = 1 Then
Call MyMacro
End If

End Sub

Ivan