Excel VBA - Code to detect changes on an specific cell(s)

Posted on 2003-02-19
Medium Priority
Last Modified: 2008-02-01

I wrote a macro that has to run every time there's a change of values on certain specific cells (2 cells to be exact). The values on those cells are typed directly, not the result from formulas or links. I need help with the code that will detect any change of value in those cells. Thanks for any help.
Question by:ed583
  • 2
LVL 43

Accepted Solution

Steve Knight earned 150 total points
ID: 7983825
Try this.  Needs pasting into the VBA area for the relevant sheet.



Private Sub Worksheet_Change(ByVal Target As Excel.Range)

   If Target.Count > 1 Then Exit Sub

   Select Case Target.Address
   Case "$A$1"
   Case "$B$1"
   End Select
End Sub


Author Comment

ID: 7991214
Thanks for your comment, Steve. Your code did not exactly solve my problem but it did, however, send me in the right direction to solve it.
I'm new to the exchange and I'm assuming that if I accept your answer you'll get the points. If not, let me know how to give them to you.
Thanks again.

LVL 43

Expert Comment

by:Steve Knight
ID: 7992386
Thats fine.  As a general rule it is normal practice to offer feedback on comments and see if experts can help further 'cos we don't really like geting B's or especially C's because they go down on our record but it doesn't matter this time.  Things haven't been helpded the last few day because the email system was down for ages.

For future information these are basically your options when you have finished with a question:

""How do I know what grade to give?":

As a general rule you have these options with an EE question:

1. If you are happy with the answer choose "accept answer" against one of the comments above.
2. If you didn't get any suitable help post a 0 point question in the Community Support area asking them to delete the question
3. Post a 0 point question in the same place if you wish to split points between different people."

Glad to have helped a bit at least


Featured Post

Independent Software Vendors: 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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I came across an unsolved Outlook issue and here is my solution.
MS Outlook undoubtedly is the most widely used email client.Its user-friendliness, cost effectiveness, and availability with Microsoft Office Suite make it the most popular email application.  Its compatibility with Microsoft applications like Exch…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question