Results 1 to 3 of 3

Cut & Past to another Workbook

Threaded View

  1. #1
    Registered User
    Join Date
    10-22-2009
    Location
    Portugal
    MS-Off Ver
    Excel 2007
    Posts
    80

    Cut & Past to another Workbook

    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.
    Last edited by Rage; 01-12-2010 at 08:01 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1