Advertisement
Guest User

Untitled

a guest
Jul 12th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Option Explicit
  2. Private Sub Worksheet_Change(ByVal Target As Range)
  3. Dim rng As Range
  4. Set rng = Range("A1")
  5.  
  6. If Not Application.Intersect(rng, Range(Target.Address)) Is Nothing Then
  7.         Call updateCells
  8. End If
  9. End Sub
  10.  
  11. Function updateCells()
  12. Dim wb       As Workbook
  13. Dim wsFirst  As Worksheet
  14. Dim wsSecond As Worksheet
  15.  
  16. Set wb = ThisWorkbook
  17. Set wsFirst = wb.Worksheets("Sheet1")
  18. Set wsSecond = wb.Worksheets("Sheet2")
  19.  
  20. wsSecond.Rows(1).Insert shift:=xlShiftDown
  21. wsSecond.Cells(1, 1) = wsFirst.Cells(1, 1).Value
  22. End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement