ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   run sub when one cell is changed (https://www.excelbanter.com/excel-programming/431576-run-sub-when-one-cell-changed.html)

NDBC

run sub when one cell is changed
 
I know i can run private subs based on something like this

Private Sub Worksheet_Change(ByVal Target As Range)

if target.address = "c20" then
.........

But in the name of efficiency is there a way to name a sub so that it is not
even activated unless a specific cell is changed.

Thanks

NDBC

run sub when one cell is changed
 
sorry for the double post but i am having trouble posting. I keep getting the
service is temporarily unavailable messages.



"NDBC" wrote:

I know i can run private subs based on something like this

Private Sub Worksheet_Change(ByVal Target As Range)

if target.address = "c20" then
........

But in the name of efficiency is there a way to name a sub so that it is not
even activated unless a specific cell is changed.

Thanks


JLGWhiz[_2_]

run sub when one cell is changed
 
The short answer is no. Something has to send a signal that the macro needs
to run. That something is an event that Excel can detect. Then something
has to tell Excel what to do after that event is detected. That is the VBA
code in this case. The name of the macro for Worksheet_Change is a
predefined constant that tells Excel to react to changes in the worksheet
that the code underlies. So it all ties together. The problem lies in
detecting the change, without using the change event.


"NDBC" wrote in message
...
I know i can run private subs based on something like this

Private Sub Worksheet_Change(ByVal Target As Range)

if target.address = "c20" then
........

But in the name of efficiency is there a way to name a sub so that it is
not
even activated unless a specific cell is changed.

Thanks





All times are GMT +1. The time now is 06:03 PM.

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