Automating VBA in excel 2002

Posted on 2003-03-06
Medium Priority
Last Modified: 2010-05-01
I have a macro in excel 2002 which I has to be run every time a value in certain portion of a worksheet changes.  Rather than having to select this to run every time a value in the work sheet changes, I would rather that the macro would run automatically every time a value in this selected area changes.

Thanks for all your help

Liam McGrath
Question by:lmg250
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

Accepted Solution

vikram_c90 earned 150 total points
ID: 8082106
Select the particular Macro from the Tools->Macro menu. On the right u will find a button called "Edit". Select your macro and click on edit. On the top of the window, u will find two dropdowns. From the first dropdown select "WorkSheet" and from the second dropdown select "SelectionChange". On doing so it will form a event subrouting skeleton for you. Cut the code of your existing macro and paste it within this skeleton. This will solve your problem.

Expert Comment

ID: 8084083
yep vikram is right, follow his instruction

Private Sub Workbook_SheetSelectionChange(ByVal Sh _
As Object, ByVal Target As Excel.Range)
    MsgBox "change"
    'put your code to run your macro
End Sub

Author Comment

ID: 8086907
Thanks for the info Vikram,


Expert Comment

ID: 8088336
Really glad to have helped

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month13 days, 2 hours left to enroll

777 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