I am trying to add a search box that will autocomplete the name of something when a user is typing a word. The table I made that list all the words I wish to show has been made in another sheet inside the name workbook.
This is the code I am using:
Private Sub ComboBox1_Click()
Dim wbExternal As Workbook 'the other workbook with the data
Dim wsExternal As Worksheet 'the worksheet in the other workbook
Dim lnLastRow As Long 'last row on the worksheet
Dim rngExternal As Range 'range of data from RowSource
Set wbExternal = Application.Workbooks("New Material Search - 2020 Draft.xlsm")
Set wsExternal = wbExternal.Worksheets("Man_Prod")
lngLastRow = wsExternal.Range("A" & wsExternal.Rows.Count).End(xlUp).Row
Set rngExternal = wsExternal.Range("A2:A" & CStr(lngLastRow))
ComboBox1 = rngExternal.Address(External:=True)
End Sub
However, in the ComboBox all I get is '[New Material Search - 2020 Draft.xlsm]Man_Prod'!$A$2:$A$6
and an error that says
This Formula is missing a range reference or a defined name.
The ComboBox should also have a dropdown list that shows all the words from the table on the other sheet.