macro to run after value in worksheet changes

0

I have a macro written which automatically updates every 1 min.

Now i want that macro to run after refresh only a particular cell value in the other sheet (same workbook) gets changed.

can you pls. let me know the code, and in which sheet it has to run

Answer
Discuss

Answers

0

Open the code sheet behind the worksheet on which you want the action. In the right pane you see two drop-downs at the top. Open the left one and select Worksheet. An event procedure will appear in the blank pane: Private Sub Worksheet_SelectionChange. Delete it.

Now select Change from the drop-down on the right. Another (very similar) event procedure will be instantly created. This time it's Private Sub Worksheet_Change. This is the one you want. Into this procedure paste the code below.

    If Target.Address = Range("A4").Address Then
        MsgBox "A4 was changed"
    End If

Now every time a change is made in A4 the message box will be shown. Change the cell address to the one that should trigger your macro and replace the instruction to show a MsgBox in the code with a call for your existing macro.

Discuss

Discussion

thanks.

Once the cell get updated how to run the macro which is needed. the macro is written in modules in visual basics and the cell value change is in sheet 1.

do i copy the macro from modules and paste in sheet 1 Visual basics?
MAHADISH Mar 23, '20 at 8:34 am
The above macro will run when the cell gets updated. Had you tried it you would know. Had you read my post you would also know. So, why do you still not know?
Variatus (rep: 3553) Mar 23, '20 at 9:33 pm
Add to Discussion


Answer the Question

You must create an account to use the forum. Create an Account or Login