Hi,
Welcome to ExcelFox !!
Try this code. The code will allow you to select the invoice file as well as the destination range. So don't need multiple macros.
Code:Sub kTest() Dim SourceFile As String Dim Dest As Range Dim wbkSource As Workbook Dim SourceData Const SourceRange = "A3:J29" With Application.FileDialog(msoFileDialogFilePicker) .Filters.Clear .AllowMultiSelect = False If .Show = -1 Then SourceFile = .SelectedItems(1) End If End With If Len(SourceFile) Then Set wbkSource = Workbooks.Open(SourceFile) SourceData = wbkSource.Worksheets("Contractors").Range(SourceRange).Value2 wbkSource.Close 0 Set wbkSource = Nothing Set Dest = Application.InputBox("Select the destination range", "Destination", "A2", Type:=8) Dest.Cells(1).Resize(UBound(SourceData, 1), UBound(SourceData, 2)) = SourceData End If End Sub




Reply With Quote
Bookmarks