ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Activating macro on mouseclick (https://www.excelbanter.com/excel-programming/355835-activating-macro-mouseclick.html)

Hmmm

Activating macro on mouseclick
 
I have been trying to set up a macro which will run when I click on a
cell, to change the value in another cell.

I have tried a number of variations around the following around Private
Sub Worksheet_SelectionChange(ByVal target As Range), but I'm getting
an error saying "Ambiguous name detected: Worksheet_SelectionChange".

All I want to do is run macro that checks the value of the clicked cell
and update another cell if appropriate.


K Dales[_2_]

Activating macro on mouseclick
 
Where did you put the macro? The message you are getting is because it can't
find the "right" version of the macro to run. Your code needs to be in the
module for the worksheet; i.e. in the VBA editor show the Project Explorer
and double-click on the line for the worksheet you are using. If you have
used the macro name Worksheet_SelectionChange in another module you added,
that might be why it is getting an "Ambiguous Name" since when you call the
macro it can't tell which one to run - the one for the sheet or the one in
the module.
--
- K Dales


"Hmmm" wrote:

I have been trying to set up a macro which will run when I click on a
cell, to change the value in another cell.

I have tried a number of variations around the following around Private
Sub Worksheet_SelectionChange(ByVal target As Range), but I'm getting
an error saying "Ambiguous name detected: Worksheet_SelectionChange".

All I want to do is run macro that checks the value of the clicked cell
and update another cell if appropriate.




All times are GMT +1. The time now is 03:12 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com