Advertisement
Guest User

Untitled

a guest
Nov 21st, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. Option Explicit
  2.  
  3. Private Sub Worksheet_Change(ByVal Target As Range)
  4. Dim KeyCells As Range
  5. Dim OtherCells As Range
  6.  
  7. ' The variable KeyCells contains the cells that will
  8. ' cause an alert when they are changed.
  9. Set KeyCells = Range("E6")
  10. If Not Application.Intersect(KeyCells, Range(Target.Address)) _
  11. Is Nothing Then
  12.  
  13. ' Display a message when one of the designated cells has been
  14. ' changed.
  15. ' Place your code here.
  16. Range("C20:I10000", Range("C20:I10000").End(xlDown)).Sort Key1:=Range("C20:I10000"), Order1:=xlAscending, Header:=xlNo
  17. Sheet2.Range("C19:C100").AutoFilter Field:=1, Criteria1:=KeyCells.Value
  18.  
  19.  
  20. End If
  21.  
  22. If Application.Intersect(KeyCells, Range(Target.Address)) _
  23. Is Nothing Then
  24. ActiveSheet.AutoFilterMode = False
  25. End If
  26. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement