?
Solved

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

Posted on 2003-02-19
3
Medium Priority
?
330 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
[X]
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
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

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