Thread: Cell change
View Single Post
  #2   Report Post  
Otto Moehrbach
 
Posts: n/a
Default

Put all of your code that you want to run into a macro called something. I
assumed a name of MyMacro.
Put that macro into a normal module.
Then paste the following macro into the sheet module of the sheet that
contains the range named TABLECALC.
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("TABLECALC")) Is Nothing Then _
Call MyMacro
End Sub
MyMacro will run anytime TABLECALC is changed.
If your code changes the value in TABLECALC and you don't want the event
macro to fire when that happens, then you need to bracket that portion of
your code that changes TABLECALC with:
Application.EnableEvents = False
'The code that changes TABLECALC
Application.EnableEvents = True
HTH Otto
"CMCCONNA" wrote in message
...
Hi all, I need help...... I have this macro that run when I hit Ctrl +A.
I
am trying to get it to run when the cell contents of a range called
"TABLECALC" are changed

Any suggestions would be great. I have looked at the worksheet change
event
but cant seem to get it to work. Thanks

Sheets("data").Visible = True
Application.Goto Reference:="tablesort"
Selection.Sort Key1:=Range("J65"), Order1:=xlDescending, Key2:=Range( _
"I65"), Order2:=xlAscending, Key3:=Range("B65"),
Order3:=xlAscending, _
Header:=xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:= _
xlTopToBottom, DataOption1:=xlSortNormal,
DataOption2:=xlSortNormal, _
DataOption3:=xlSortNormal
ActiveWindow.SelectedSheets.Visible = False
Range("A1").Select