Hello -

Previously I got help from this forum with the code below. In a nutshell, it allows the used to select a template from a drop down and when the form is submitted it pulls all matching items from the Templates sheet and copies them over to the Invoice sheet.

I need to move the Templates sheet to another workbook (on a shared drive). How would I modify the code below to make this work?

Thanks again for all your help!


Sub LoadTemplate()
 
Const shProjectInfo As String = "PROJECT INFORMATION"
Const shTemplate As String = "Templates"
Const shInvoice As String = "Invoice"
 
Const sInvoice As String = "a15:g56"
 
Dim arr, i As Long, ptr As Long
Dim sWhatTemplate As String
 
With Worksheets(shProjectInfo)
    sWhatTemplateA = .Range("b3").Value
End With
With Worksheets(shTemplate)
    arr = .Range("a1").CurrentRegion
End With
With Worksheets(shInvoice)
    .Range(sInvoice).ClearContents
    ptr = 15
    For i = 1 To UBound(arr)
        If arr(i, 1) = sWhatTemplateA Then
            .Cells(ptr, 1).Resize(, 7) = Array(arr(i, 2), arr(i, 3), arr(i, 4), arr(i, 5), arr(i, 6), arr(i, 7), arr(i, 8))
            ptr = ptr + 1
        End If
    Next
    .Activate
End With

End Sub