Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50307

Start Macro from Cell change in WS

$
0
0
Hi everyone,

I have some code that I would like to start when a cell is changed on another worksheet. I've tried selectionchange and change and caluclate. But they all stop at the same point in the code, "Rows("6:5000").Select".

Its only simple bit of code. Any thoughts:confused:

Code:

Application.ScreenUpdating = False
    Sheets("DL").Select
    Rows("6:5000").Select
    Selection.ClearContents
    Range("A5:J5").Select
    Selection.Copy
    Sheets("prod").Select
    Range("A5").Select
    Selection.Insert Shift:=xlDown
    Sheets("DL").Select
   
    Sheets("prod").Range("A5:J5000").AdvancedFilter Action:=xlFilterCopy, _
        CriteriaRange:=Range("A3:J4"), CopyToRange:=Range("A5:J5"), Unique:= _
        False
    Range("A6:J5000").Select
    Selection.Sort Key1:=Range("C6"), Order1:=xlDescending, Key2:=Range("D6") _
        , Order2:=xlDescending, Header:=xlNo, OrderCustom:=1, MatchCase:=False _
        , Orientation:=xlTopToBottom, DataOption1:=xlSortNormal, DataOption2:= _
        xlSortNormal
   
    Sheets("prod").Select
    Rows("5:5").Select
    Selection.Delete Shift:=xlUp
   
    Application.ScreenUpdating = True
End Sub


Viewing all articles
Browse latest Browse all 50307

Latest Images

Trending Articles



Latest Images