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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automatically run macro when cell is updated

Status
Not open for further replies.

mcelligott

Programmer
Apr 17, 2002
135
US
Hello,

I have a macro that I would like to run automatically if a cell is updated in excel. Does anyone know how this can be accomplished?

The macro updates all the worksheet headers (all 20) to what is in A1 of the first sheet. I currently have it attached to a button but would like to make the macro run automatically if the field is changed.

Any help would be greatly appreciated.

Thanks,

Bob
 
Hi,

Use the Worksheet_Change event, something like this...
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Target, [A1]) Is Nothing Then
        YourMacro
    End If
End Sub
on your sheet that your cell change is on, right-click and select View Code This is where the code goes.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top