Guest User

Untitled

a guest
Dec 5th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. =HYPERLINK('C:Reports2018[2018.xlsx]Sheet1'!U21)
  2.  
  3. Dim wkbYear
  4.  
  5.  
  6. Private Sub Worksheet_Change(ByVal Target As Range)
  7.  
  8. If Target.Address = "$E$1" Then
  9. ' here i replace the formula 2018 -> 2019
  10. ' file 1
  11. Sheets("Sheet2").Range("B6").Formula = Replace(Sheets("Sheet2").Range("B6").Formula, wkbYear, Target)
  12. ' file 2
  13. Sheets("Sheet2").Range("D6").Formula = Replace(Sheets("Sheet2").Range("D6").Formula, wkbYear, Target)
  14. ' I excluded the 20 other similar lines of code here.
  15. End If
  16.  
  17. End Sub
  18.  
  19. Private Sub Worksheet_SelectionChange(ByVal Target As Range)
  20. If Target.Address = "$E$1" Then
  21. wkbYear = Range("E1").Value ' Old year value
  22. End If
  23. End Sub
Add Comment
Please, Sign In to add comment