judgejustin
Board Regular
- Joined
- Mar 3, 2014
- Messages
- 139
This code works up to the point of pasting. It is suppose to paste the copied cell range to the cell that was double clicked in the original workbook. Any thoughts?
Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim OpenBook As Workbook
Dim spath As String
If Target.Column <> 14 Then Exit Sub
spath = ThisWorkbook.Path & "\"
Application.ScreenUpdating = False
Set OpenBook = Workbooks.Open(Filename:=spath & ActiveCell.Offset(, -11) & ".xlsm", UpdateLinks:=True)
With OpenBook
.Sheets("AGR").Range("K11").Copy
ThisWorkbook.Worksheets("Statistics").Target.PasteSpecial xlPasteValues
.Sheets("AGR").Range("K9").Copy
ThisWorkbook.Worksheets("Statistics").Target.Offset(, 1).PasteSpecial xlPasteValues
.Close True
End With
Application.ScreenUpdating = True
End Sub