Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.
Sub CopyFromNotInvoicedWB(strSourceWB As String, _ strSourceWS As String, strSourceRange As String, _ rngTarget As Range) ' copies information from a closed workbook, no input validation! Dim wb As Workbook Application.ScreenUpdating = False ' turn off the screen updating Application.StatusBar = "Copying data from " & strSourceWB & "..." On Error Resume Next ' ignore errors ' open the source workbook, read only Set wb = Workbooks.Open(strSourceWB, True, True) On Error GoTo 0 ' stop when errors occur If Not wb Is Nothing Then ' opened the workbook On Error Resume Next ' ignore errors With wb.Worksheets(strSourceWS).Range(strSourceRange) .Copy rngTarget .PasteSpecial xlPasteValues End With On Error GoTo 0 ' stop when errors occur wb.Close False ' close the source workbook without saving changes Set wb = Nothing ' free memory Worksheets("Avon Not Invoiced").Cells.Font.Size = 8 End If Application.StatusBar = False ' reset status bar Application.ScreenUpdating = True ' turn on the screen updating End Sub Sub CopyNotInvoiced() Worksheets("Avon Not Invoiced").Range("A2:L250").ClearContents CopyFromNotInvoicedWB "E:\AccuRounds Daily Shipped Not Invoiced.xls", _ "Sheet1", "A3:L250", Range("A2") End Sub
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
21 Experts available now in Live!