Thread: [Solved] Debug error
View Single Post
 
Old 09-29-2016, 05:30 PM
charlesdh charlesdh is offline Windows 7 32bit Office 2010 32bit
Expert
 
Join Date: Apr 2014
Location: Mississippi
Posts: 382
charlesdh is on a distinguished road
Default

Hi,

This is a sample code. But it should work. However you should not copy the entire columns. You should get the "Last" used row and set the copy from "A1:O" & lastrow".
You can do some research as to how to find the last used row.
See if you can do this and if not get back too us.

Code:
Sub teat()
Sheets("Master").Activate
Range("A1:O" & lastrow).Select
Selection.Copy
    Workbooks.Open Filename:= _
        "https://sharepoint.fngn.com/departments/ced/CommunicationsDelivery/PrintProd/Reports%20Library/MasterTableDBase2016.xlsx" _
        , UpdateLinks:=3
   Sheets("Master").Activate
    range("A1").Select''You do not need to select the entire range 
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
       
    
    ActiveWorkbook.Save
    ActiveWindow.Close
    Application.CutCopyMode = False
End Sub
Reply With Quote