New to VBA...
I have an invoice template with a data validation dropdown in Sheet1!A10 with the list location in Sheet3!B2:B4
I'm looking for help with returning the value in the Sheet3!A2:A4 based on the dropdown selection (Sheet3!B2:B4) in order to save a copy of the file with the offset values from the dropdown.
This is what I have so far based on search results, but I know I'm missing something somewhere
Sub FileSaveAs()
Dim custlist As String
Dim custname As String
Dim path As String
Dim filename As String
custlist = Sheets(1).DropDowns(Range("A10:C10"))
custname = Application.WorksheetFunction.VLookup(custlist, Sheet3.Range("a:b"), 1, False)
path = "C:\Users\files"
filename = custname
Sheet1.Copy
With ActiveWorkbook
.Sheets(1).Name = "Invoice"
.SaveAs filename:=path & filename, FileFormat:=51
.Close
End With
End Sub
I don't know how to set the the value of custname based on the dropdown selection custlist.
Microsoft documentation: