Advertisement
YasserKhalil2019

T4471_Using Application Match In Worksheet Change Template

Dec 28th, 2019
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. https://excel-egy.com/forum/t4471
  2. ---------------------------------
  3.  
  4. Private Sub Worksheet_Change(ByVal Target As Range)
  5. If Target.Cells.CountLarge > 1 Then Exit Sub
  6.  
  7. If Target.Row > 9 Then
  8. If Target.Column = 11 Or Target.Column = 13 Then
  9. Dim x, y, sh As Worksheet
  10. Set sh = ThisWorkbook.Worksheets("CusPay")
  11. x = Application.Match(Cells(Target.Row, 13).Value2, sh.Columns(1), 0)
  12. If Not IsError(x) Then
  13. y = Application.Match(Cells(Target.Row, 11).Value2, sh.Rows(1), 0)
  14. If Not IsError(y) Then
  15. sh.Cells(x, y).Value = Cells(Target.Row, 9).Value
  16. End If
  17. End If
  18. End If
  19. End If
  20. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement