, 1). MergeCells = False And k <>. Range ("End" & num). Row
ComboBox3.AddItem. Cells (k, 1). Value
k = k + 1
Loop
End With
Else
For Each Sheet In Workbooks ("Firms.xls"). Worksheets
flagnet = 0
If Sheet.Name <> "1" Then
k = 0
num = Workbooks ("Firms.xls"). Worksheets (Sheet.Name). Index
ie = Workbooks ("Firms.xls"). Worksheets (Sheet.Name). Range ("End" & num). Row
If ie <> 6 Then
With Workbooks ("Firms.xls"). Worksheets (Sheet.Name)
For ib =. Range ("Beg" & num). Row + 1 To ie
If ComboBox2.Value = CStr (. Cells (ib, 1). Value) And. Cells (ib, 1). MergeCells = True Then
flagnet = 1
k =. Cells (ib, 1). Row
Exit For
End If
Next ib
If flagnet = 1 Then
k = k + 1
temp = k
Do While. Cells (k, 1). MergeCells = False And k <>. Range ("End" & num). Row
If ComboBox3.ListCount = 0 Then
ComboBox3.AddItem. Cells (k, 1). Value
k = k + 1
Else
flaf = 0
For p = 0 To ComboBox3.ListCount - 1
If ComboBox3.List (p) =. Cells (k, 1). Value Then
flaf = 1
Exit For
Else
flaf = 0
End If
Next p
If flaf = 0 Then
ComboBox3.AddItem. Cells (k, 1). Value
k = k + 1
Else
k = k + 1
End If
End If
Loop
End If
End With
End If
End If
Next Sheet
End IfSubSub CommandButton1_Click ()
flag = 0
flag2 = 0
maxi = 12
k = 0
i = 4
'якщо нічого не обрано
If ComboBox1.Value = "" And ComboBox2.Value = "" _
And ComboBox3.Value = "" And TextBox2.Text = "" _
And TextBox3.Text = "" And TextBox4.Text = "" _
And TextBox5.Text = "" Then
MsgBox "Виберіть необхідні критерії для пошуку.", vbCritical, "Помилка!"
Exit Sub
End If
'якщо обрана тільки фірма
If ComboBox1.Value <> "" And ComboBox2.Value = "" _
And ComboBox3.Value = "" And TextBox2.Text = "" _
And TextBox3.Text = "" And TextBox4.Text = "" _
And TextBox5.Text = "" Then
Workbooks ("Firms.xls"). Worksheets (CStr (ComboBox1.Value)). Activate
Me.Hide
End If
'якщо обрана тільки країна
If ComboBox1.Value = "" And ComboBox2.Value <> "" _
And ComboBox3.Value = "" And TextBox2.Text = "" _
And TextBox3.Text = "" And TextBox4.Text = "" _
And TextBox5.Text = "" Then
For Each Sheet In Workbooks ("Firms.xls"). Worksheets
k = 0
If Sheet.Name <> "1" Then
num = Workbooks ("Firms.xls"). Worksheets (Sheet.Name). Index
ie = Workbooks ("Firms.xls"). Worksheets (Sheet.Name). Range ("End" & num). Row
If ie <> 6 Then
Wit...