Я хочу создать 2 поля со списком, но получаю ошибку 1004 Функция соответствия. Вот мой код:
Private Sub ComboBox2_Change()
Dim sh As Worksheet
Set sh = ThisWorkbook.Sheets("PCB_data")
Dim i, n As Integer
Me.ComboBox3.Clear
n = Application.WorksheetFunction.Match(Me.ComboBox2.Value, sh.Range("1:1"), 0)
For i = 2 To Application.WorksheetFunction.CountA(sh.Cells(1, n).EntireColumn)
Me.ComboBox3.AddItem sh.Cells(i, n).Value
Next i
Me.ComboBox2.ListRows = 20
End Sub
Private Sub UserForm_Activate()
Dim sh As Worksheet
Set sh = ThisWorkbook.Sheets("PCB_data")
Dim i As Integer
Me.ComboBox3.Clear
For i = 1 To Application.CountA(sh.Range("1:1"))
Me.ComboBox2.AddItem sh.Cells(1, i).Value
Next i