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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Office 365 Training for Admins - 7 Day Trial

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
This article describes a serious pitfall that can happen when deleting shapes using VBA.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

762 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