Hi all, i need some help on the following function.
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim iAns As Integer
Dim bOffset As Byte, strWSDone As String, strTbl As String, strCrit As String, strBook As String
If Intersect(Target, Range("Table1143")) Is Nothing Then Exit Sub
On Error GoTo ExitPoint
Application.EnableEvents = False
Select Case Target.Column
Case 5
strBook = "D:\Updated\Book2.xlsm"
strWSDone = "Payment Sheet"
strTbl = "Table2378"
strCrit = "Done"
Case Else
GoTo ExitPoint
End Select
If Target.Value = strCrit Then
iAns = MsgBox("WARNING!!! ARE YOU SURE YOU WANT TO DO THIS ???", vbYesNo + vbDefaultButton2 + vbQuestion)
If iAns = vbNo Then GoTo ExitPoint
Cells(Target.Row, "A").Resize(, 10).Copy
With Sheets(strWSDone)
With .Range(strTbl)
bOffset = -(.Cells(.Rows.Count, "A").Value <> "")
End With
.Cells(.Rows.Count, "A").End(xlUp).Offset(bOffset).PasteSpecial Paste:=xlPasteAllUsingSourceTheme
End With
Cells(Target.Row, "A").Resize(, 10).ClearContents
End If
ExitPoint:
Set wsDone = Nothing
Application.EnableEvents = True
End Sub
I cant seem to get it to open the Book2.xlsm (colored in green in the code above) and paste the info.
This is probably easy for the experts on VBA, any help would be welcome.
Bookmarks