I currently have a userform with 3 inputs (DevID, DevSel and LocSel). The Idea is to copy a template sheet based off combobox DevSel, and rename the sheet based on the DevID text box. The issue I have is I have combobox LocSel poplated with the defined range "Headers" (A1:F1) and want to use V&HLooup, or HLookup & Match to return first blank cell under the matched LocSel header, and make it equal DevID.
Private Sub Execute_Btn_Click()
Dim Headers As Range
Dim LocID As Range
Select Case DevSel
Case "HVBKR"
'Make a copy of the selected sheet
Sheets("HVCIRCUITBREAKER_TEMP").Visible = True
Sheets("HVCIRCUITBREAKER_TEMP").Copy After:=Sheets("Master")
Sheets("HVCIRCUITBREAKER_TEMP").Visible = False
ActiveSheet.Name = Me.DevID.Text
'Autopopulate site list
WorksheetFunction.HLookup(LocSel, Range("Headers"), WorksheetFunction.Match(LocSel, Range("Headers").End(xlUp).Offset(1), False), False) = DevID
End Select
Unload Me
Sheets("Master").Activate
End Sub
In the Debugger, LocSel and DevID are populating with the correct information. based on my box selections, but I keep getting Runtime Error1004 - Unable to get the Match property of the worksheetfunction class. Any help would be appreciated!