Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Automating VBA in excel 2002

Posted on 2003-03-06
4
Medium Priority
?
213 Views
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
0
Comment
Question by:lmg250
  • 2
4 Comments
 

Accepted Solution

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

Expert Comment

by:Mango2
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
0
 

Author Comment

by:lmg250
ID: 8086907
Thanks for the info Vikram,

Liam
0
 

Expert Comment

by:vikram_c90
ID: 8088336
Really glad to have helped
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

571 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