ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   On Edit activation (https://www.excelbanter.com/excel-programming/285506-edit-activation.html)

tjb21045

On Edit activation
 
Can anyone tell me a way to have a macro execute based on the value of a
cell changing?


---
Message posted from http://www.ExcelForum.com/


Norman Harker

On Edit activation
 
Hi tjb21045!


Try something like:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address < "$a$1" Then Exit Sub
<<Your Code
End Sub

This is placed in the Sheet Module where the target cell is located.
Easiest means of access is to right click the sheet tab and select
View Code. If you click the left drop down above the code window and
select Worksheet and then click the right drop down and select Change,
you'll find that your macro is topped and tailed correctly.

I think that you'll find a Google search on Worksheet Change will give
you lots of examples.

--
Regards
Norman Harker MVP (Excel)
Sydney, Australia

Excel and Word Function Lists (Classifications, Syntax and Arguments)
available free to good homes.
"tjb21045" wrote in message
...
Can anyone tell me a way to have a macro execute based on the value

of a
cell changing?


---
Message posted from
http://www.ExcelForum.com/




Jim Rech

On Edit activation
 
You could use the sheet change event:

http://support.microsoft.com/default...23&Product=xlw

--
Jim Rech
Excel MVP



Tom Ogilvy

On Edit activation
 
Your if test will always be evaluated as true as written as the address
comes back as $A$1 (unless you set Option Compare Text).

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address < "$A$1" Then Exit Sub
<<Your Code
End Sub

--
Regards,
Tom Ogilvy


Norman Harker wrote in message
...
Hi tjb21045!


Try something like:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address < "$a$1" Then Exit Sub
<<Your Code
End Sub

This is placed in the Sheet Module where the target cell is located.
Easiest means of access is to right click the sheet tab and select
View Code. If you click the left drop down above the code window and
select Worksheet and then click the right drop down and select Change,
you'll find that your macro is topped and tailed correctly.

I think that you'll find a Google search on Worksheet Change will give
you lots of examples.

--
Regards
Norman Harker MVP (Excel)
Sydney, Australia

Excel and Word Function Lists (Classifications, Syntax and Arguments)
available free to good homes.
"tjb21045" wrote in message
...
Can anyone tell me a way to have a macro execute based on the value

of a
cell changing?


---
Message posted from
http://www.ExcelForum.com/







All times are GMT +1. The time now is 07:59 PM.

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