?
Solved

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

Posted on 2003-02-19
3
Medium Priority
?
357 Views
Last Modified: 2008-02-01
Hello,

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.
0
Comment
Question by:ed583
  • 2
3 Comments
 
LVL 43

Accepted Solution

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

hth

Steve

Private Sub Worksheet_Change(ByVal Target As Excel.Range)

   If Target.Count > 1 Then Exit Sub

  appliction.enableevents=false
   
   Select Case Target.Address
   Case "$A$1"
       RunMyMacro
   Case "$B$1"
       RunMyMacro
   End Select
   
  appliction.enableevents=true
End Sub

0
 

Author Comment

by:ed583
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.

Ed
0
 
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?":
http://www.experts-exchange.com/jsp/cmtyQuestAnswer.jsp#3

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

Steve
0

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