Run a macro after clicking into cell

E

Esradekan

I wish to run a macro after clicking into various cells.

I have 10 different macros and 10 cells with names of these macors and
I wish to run the relevant macro when I click into the cell.

ie. A1 content = "Scores" and when I click into that cell, I wish the
"Scores" macro to run.

Can this be done?
If so, how?

TIA
Esra
 
D

Don Guillett

Easily done but give us all the detail and the code. There is probably an
easier way.
 
E

Esradekan

I have a master grid of Sports Teams (Aussie Rules), that the macros
copy and paste from the team sheets so I can see at a glance the team
home and away status, game results etc.

ie. If i want to view the Adelaide team stats, and game results etc,
i wish to copy from the team page those stats, simple copy/paste macro
(AdelaideScores). If I want Brisbane stats, I click into the Cell
with Brisbane in it, and run the macro BrisbaneScores.

Makes it easier for team comparisons.

I already have the copy/paste macros done, (ie AdelaideScores,
BrisbaneScores etc) and the grid where the macros paste, just would
rather do it by clicking in the team cell, than assigning the macro to
an object. Its tidier.

Does that make sense? Hope so


TIA for help

Esra
 
D

Don Guillett

You really didn't give enough info but you could probably use a double_click
event from the sheet module or even a drop down list. Send the workbook to
my address below if you would like me to take a look at making this better.
 
D

Don Guillett

Sent him this to replace a bunch of very long macros.

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
If Not Intersect(Target, Range("L6:L21")) Is Nothing Then
mysht = Application.Substitute(target, " ", "")
Range("m2") = Target
Range("m6:x21").Value = _
Sheets(mysht).Range("c6:n21").Value
End If
End Sub
 
E

Esra Dekan

Thanks Don, your a legend, over and above what I asked, problem
sorted. I bow to your wisdom.

Esra
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top