You can't assign a macro to cell, you could activate it by various worksheet events such as Double Click
Is it possible to click in a cell in Excel to run a macro? assign macro to
cell type thing.
thanks
You can't assign a macro to cell, you could activate it by various worksheet events such as Double Click
Hope that Helps
Roy
For free Excel tools & articles visit my web site
If I have helped you and you feel like putting your hand in your pocket please make a donation to Children in Need
About me.
Thanks for that.
How do you assign it to a double click event?
Open the VBE (Alt+F11) and then double click the Sheet in the Project Explorer the code applies to. This is where the code MUST be placed.
Replace MyMacro with your macro's nameVB:Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) Call MyMacro End Sub
Hope that Helps
Roy
For free Excel tools & articles visit my web site
If I have helped you and you feel like putting your hand in your pocket please make a donation to Children in Need
About me.
thanks so much for that. you have saved my life!!!!![]()
can you use this method for different macros and different cells etc... if i was to double click in a1 then e1 is pink, if i double click in b1 then f1 is red?? i was trying with an if statement using the activecell range but can get it working.
is this what you mean?
VB:Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) Dim i As Integer If Target.Cells.Count > 1 Then Exit Sub i = Target.Column Select Case i Case 1: ActiveCell.Offset(0, 5).Interior.ColorIndex = 5 Case 2: ActiveCell.Offset(0, 5).Interior.ColorIndex = 3 Case 3: ActiveCell.Offset(0, 5).Interior.ColorIndex = 12 End Select End Sub
Hope that Helps
Roy
For free Excel tools & articles visit my web site
If I have helped you and you feel like putting your hand in your pocket please make a donation to Children in Need
About me.
thats great.thanks sooooooooooooooo much![]()
There are currently 4 users browsing this thread. (0 members and 4 guests)
Bookmarks