Starting Marco

elgringo56

Well-known Member
Joined
Apr 15, 2002
Messages
869
Is there a way to cause a certian macro to run when a cell is selected. Example, When Cell B2 is selected, either by direct selection or by tabbing, execute a macro named "ShowBusy"? This would be rather helpfull to me if anyone knows of a way. Thanks.......ElGringo
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Hi ElGringo.
Right click on the sheet tab, select View Code and Please copy this into there.

<pre>
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address(0, 0) = "B2" Then ShowBusy
End Sub
</pre>
 
Upvote 0
Pretty fantastic. Does just what I want. Can I put more than one entry so that various cells can start various macros?
Again, Thanks a Million
 
Upvote 0
Hi.
If you have various macros named "Shushi","Tenpura","Ninja".....
An easy way to execute more than one entry is to use "Select Case" method.

Here is a sample.

<pre>
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
Select Case Target.Address(0, 0)
Case "B2"
Shushi
Case "B3"
tenpura
Case "B4"
ninja
End Select
End Sub
</pre>
 
Upvote 0

Forum statistics

Threads
1,214,827
Messages
6,121,812
Members
449,048
Latest member
greyangel23

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top