Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

run macro when I change value in excel cell 1

Status
Not open for further replies.

navyguy

Programmer
Aug 10, 2002
30
US
Hello, I am writing a visual basic macro for excel. I would like the maro to run whenever the user changes the value in a particular cell of the excel spreadsheet.

Any ideas....

Thanks
 
Right click on the sheet tab of the sheet containg the cell, select View Code and enter the following :
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, [A1]) Is Nothing Then
     'Insert code or call to procedure here
End If
End Sub
replacing A1 with the address of the cell you are interested in and insert either the code you want to run or a call to some procedure you want to activate when that cell changes.

A.C.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top