• Copy&Paste to new workbook (English/Excel 2000)

    Home » Forums » AskWoody support » Productivity software by function » Visual Basic for Applications » Copy&Paste to new workbook (English/Excel 2000)

    Author
    Topic
    #389577

    I have a macro installed on about 20 office P.C.s that copies information from a working file on their local drive to a “gathering” file on a network drive (using Access for this project is not an option). The macro works well with one odd quirk. Each week the information from one user does not get transferred. It is a different user each week and none of them received any message boxes or other warnings when performing the transfer. I did test the macro when the network file was open and I received the message box stating that the file was unavailable for editing. I’ve included the portion of the macro that performs the paste operations and am looking for any ideas on why this is happening. THANKS ‘opens Worked Permits worksheet
    ChDir “P:”
    Workbooks.Open Filename:=”P:DataWorkedFile.xls”
    ‘selects cell Al
    Range(“A1”).Select
    ‘moves to next available row
    Selection.End(xlDown).Select
    ActiveCell.Offset(1, 0).Range(“A1”).Select
    Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, _
    SkipBlanks:=False, Transpose:=False

    Viewing 0 reply threads
    Author
    Replies
    • #688627

      Depending on what the data in the sheets looks like, there are a couple of things in that code that could be causing some problems. Try using something like the following:

      Dim oTWB As Workbook, oCell As Range
          Set oTWB = Workbooks.Open(Filename:="C:WorkWorkedFile.xls")
          Set oCell = oTWB.Worksheets("Sheet1").Range("A65536").End(xlUp).Offset(1, 0)
          oCell.PasteSpecial Paste:=xlValues, Operation:=xlNone, _
          SkipBlanks:=False, Transpose:=False
      
    Viewing 0 reply threads
    Reply To: Copy&Paste to new workbook (English/Excel 2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: