• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 147
  • Last Modified:

Easy one. How do I activate a macro if ActiveCell changes?

Hi,

I am sure this is easy!

Let's say I am in any cell of a sheet.

I want to run macro1 if I move to any other cell.

I.e. if I move cell at all - I want to run macro1

How do I do this?
0
Patrick O'Dea
Asked:
Patrick O'Dea
3 Solutions
 
Tony GiangrecoCommented:
0
 
Martin LissRetired ProgrammerCommented:
Call the macro in the Worksheet_SelectionChange event.
0
 
Saqib Husain, SyedEngineerCommented:
Right-click on the sheet tab name
Select view code
in the first dropdown above the code pane select worksheet
in the second dropdown above the code pane select selectionchange

now place your code there.
0
 
Patrick O'DeaAuthor Commented:
Thanks all!
0
 
Saqib Husain, SyedEngineerCommented:
The above sequence will work for only that particular worksheet.

If you want this to happen in any worksheet of a given workbook then from that workbook
goto the vba window
double-click on the workbook module
in the first dropdown above the code pane select workbook
in the second dropdown above the code pane select sheetselectionchange
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now