1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
| Sub w1sws()
Dim a As Range
Dim options As Long
Dim opt As Long
Dim o As Long
Dim Results As Long
Dim re As Long
Dim KeywordsC As Long
Dim KeywordsC2 As Long
Dim KeywordsC3 As Long
Dim ResultFields As Long
Dim Counter As Integer
Dim RowMax As Integer, ColMax As Integer
Dim r As Integer, c As Integer
Dim PctDone As Single
Dim pi As New ProgressIndicator
pi.Show "Progress" 'Для вывода прогрессбара
KeywordsC = 2
KeywordsC2 = 3
KeywordsC3 = 4
options = Worksheets(1).Range("E:E").Cells.SpecialCells(xlCellTypeConstants).Count
'заполненные строки
opt = options - 1
'-1на строка с заголовком
o = opt + 5
'с 5й начинаеться
' такая схема не учитывает кол-во пустых строк (10заполнил 1 пропустил ищет 11 клеток а не 12)
'LastRow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row
ResultFields = 5
'Вывод колонок с результатами
Results = Worksheets(2).Range("B:B").Cells.SpecialCells(xlCellTypeConstants).Count
re = Results + 1
Worksheets(2).Cells(1, 3) = "Группа"
Worksheets(2).Cells(1, 4) = "Тип"
Worksheets(2).Cells(1, 5) = "Модель"
Worksheets(2).Cells(1, 6) = "Проверки"
'Определение параметров прогрессбара
pi.StartNewAction 0, 95, "Porocess", , , o * 3
'Далее классификация по уровням
For j = 6 To o
pi.SubAction , "$index & $count" 'Вывод прогрессбара и его обновление , "$time" + время
Set a = Worksheets(2).Range("B1:B" & re).Find(What:=Worksheets(1).Cells(j, KeywordsC), LookIn:=xlValues, Lookat:=xlPart, MatchCase:=False)
If Not a Is Nothing Then
firstaddress = a.Address
Do
For i = 1 To ResultFields
If IsEmpty(a.Offset(0, i)) And IsEmpty(a.Offset(0, i + 1)) Then
a.Offset(0, i).Value = Worksheets(1).Cells(j, i + KeywordsC + 2)
End If
Next i
Set a = Worksheets(2).Range("B1:B" & re).FindNext(a)
Loop While Not a Is Nothing And a.Address <> firstaddress
End If
Next j
For j = 6 To o
pi.SubAction , "$index & $count"
Set a = Worksheets(2).Range("B1:B" & re).Find(What:=Worksheets(1).Cells(j, KeywordsC2), LookIn:=xlValues, Lookat:=xlPart, MatchCase:=False)
If Not a Is Nothing Then
firstaddress = a.Address
Do
For i = 1 To ResultFields
a.Offset(0, i).Value = Worksheets(1).Cells(j, i + KeywordsC2 + 1)
Next i
Set a = Worksheets(2).Range("B1:B" & re).FindNext(a)
Loop While Not a Is Nothing And a.Address <> firstaddress
End If
Next j
For j = 6 To o
pi.SubAction , "$index & $count"
Set a = Worksheets(2).Range("B1:B" & re).Find(What:=Worksheets(1).Cells(j, KeywordsC3), LookIn:=xlValues, Lookat:=xlPart, MatchCase:=False)
If Not a Is Nothing Then
firstaddress = a.Address
Do
For i = 1 To ResultFields
a.Offset(0, i).Value = Worksheets(1).Cells(j, i + KeywordsC3)
Next i
Set a = Worksheets(2).Range("B1:B" & re).FindNext(a)
Loop While Not a Is Nothing And a.Address <> firstaddress
End If
Next j
pi.Hide 'Убираем прогрессбар
Worksheets(2).[B:B].SpecialCells(xlCellTypeBlanks).EntireRow.Delete 'удаляем последнюю строку (т.к. она ошибочно заполняется)
End Sub
Sub Button7_Click()
Dim a As Range
Dim options As Long
Dim opt As Long
Dim o As Long
Dim Results As Long
Dim re As Long
Dim KeywordsC As Long
Dim KeywordsC2 As Long
Dim KeywordsC3 As Long
Dim ResultFields As Long
Dim Counter As Integer
Dim RowMax As Integer, ColMax As Integer
Dim r As Integer, c As Integer
Dim PctDone As Single
Dim pi As New ProgressIndicator
pi.Show "Progress"
KeywordsC = 2
KeywordsC2 = 3
KeywordsC3 = 4
options = Worksheets(1).Range("E:E").Cells.SpecialCells(xlCellTypeConstants).Count
opt = options - 1
o = opt + 5
ResultFields = 5
Results = Worksheets(2).Range("B:B").Cells.SpecialCells(xlCellTypeConstants).Count
re = Results + 1
Worksheets(2).Cells(1, 3) = "Группа"
Worksheets(2).Cells(1, 4) = "Тип"
Worksheets(2).Cells(1, 5) = "Модель"
Worksheets(2).Cells(1, 6) = "Проверки"
pi.StartNewAction 0, 95, "Porocess", , , o
For j = 6 To o
pi.SubAction , "$index & $count"
Set a = Worksheets(2).Range("B1:B" & re).Find(What:=Worksheets(1).Cells(j, KeywordsC), LookIn:=xlValues, Lookat:=xlPart, MatchCase:=False)
If Not a Is Nothing Then
firstaddress = a.Address
Do
For i = 1 To ResultFields
If IsEmpty(a.Offset(0, i)) And IsEmpty(a.Offset(0, i + 1)) Then
a.Offset(0, i).Value = Worksheets(1).Cells(j, i + KeywordsC + 2)
End If
Next i
Set a = Worksheets(2).Range("B1:B" & re).FindNext(a)
Loop While Not a Is Nothing And a.Address <> firstaddress
End If
Next j
pi.Hide
Worksheets(2).[B:B].SpecialCells(xlCellTypeBlanks).EntireRow.Delete
End Sub
Sub Button8_Click()
Dim a As Range
Dim options As Long
Dim opt As Long
Dim o As Long
Dim Results As Long
Dim re As Long
Dim KeywordsC As Long
Dim KeywordsC2 As Long
Dim KeywordsC3 As Long
Dim ResultFields As Long
Dim Counter As Integer
Dim RowMax As Integer, ColMax As Integer
Dim r As Integer, c As Integer
Dim PctDone As Single
Dim pi As New ProgressIndicator
pi.Show "Progress"
KeywordsC = 2
KeywordsC2 = 3
KeywordsC3 = 4
options = Worksheets(1).Range("E:E").Cells.SpecialCells(xlCellTypeConstants).Count
opt = options - 1
o = opt + 5
ResultFields = 5
Results = Worksheets(2).Range("B:B").Cells.SpecialCells(xlCellTypeConstants).Count
re = Results + 1
Worksheets(2).Cells(1, 3) = "Группа"
Worksheets(2).Cells(1, 4) = "Тип"
Worksheets(2).Cells(1, 5) = "Модель"
Worksheets(2).Cells(1, 6) = "Проверки"
pi.StartNewAction 0, 95, "Porocess", , , o
For j = 6 To o
pi.SubAction , "$index & $count"
Set a = Worksheets(2).Range("B1:B" & re).Find(What:=Worksheets(1).Cells(j, KeywordsC2), LookIn:=xlValues, Lookat:=xlPart, MatchCase:=False)
If Not a Is Nothing Then
firstaddress = a.Address
Do
For i = 1 To ResultFields
a.Offset(0, i).Value = Worksheets(1).Cells(j, i + KeywordsC2 + 1)
Next i
Set a = Worksheets(2).Range("B1:B" & re).FindNext(a)
Loop While Not a Is Nothing And a.Address <> firstaddress
End If
Next j
pi.Hide
Worksheets(2).[B:B].SpecialCells(xlCellTypeBlanks).EntireRow.Delete
End Sub
Sub Button9_Click()
Dim a As Range
Dim options As Long
Dim opt As Long
Dim o As Long
Dim Results As Long
Dim re As Long
Dim KeywordsC As Long
Dim KeywordsC2 As Long
Dim KeywordsC3 As Long
Dim ResultFields As Long
Dim Counter As Integer
Dim RowMax As Integer, ColMax As Integer
Dim r As Integer, c As Integer
Dim PctDone As Single
Dim pi As New ProgressIndicator
pi.Show "Progress"
KeywordsC = 2
KeywordsC2 = 3
KeywordsC3 = 4
options = Worksheets(1).Range("E:E").Cells.SpecialCells(xlCellTypeConstants).Count
opt = options - 1
o = opt + 5
ResultFields = 5
Results = Worksheets(2).Range("B:B").Cells.SpecialCells(xlCellTypeConstants).Count
re = Results + 1
Worksheets(2).Cells(1, 3) = "Группа"
Worksheets(2).Cells(1, 4) = "Тип"
Worksheets(2).Cells(1, 5) = "Модель"
Worksheets(2).Cells(1, 6) = "Проверки"
pi.StartNewAction 0, 95, "Porocess", , , o
For j = 6 To o
pi.SubAction , "$index & $count"
Set a = Worksheets(2).Range("B1:B" & re).Find(What:=Worksheets(1).Cells(j, KeywordsC3), LookIn:=xlValues, Lookat:=xlPart, MatchCase:=False)
If Not a Is Nothing Then
firstaddress = a.Address
Do
For i = 1 To ResultFields
a.Offset(0, i).Value = Worksheets(1).Cells(j, i + KeywordsC3)
Next i
Set a = Worksheets(2).Range("B1:B" & re).FindNext(a)
Loop While Not a Is Nothing And a.Address <> firstaddress
End If
Next j
pi.Hide
Worksheets(2).[B:B].SpecialCells(xlCellTypeBlanks).EntireRow.Delete
End Sub
Sub Formatias(ByVal n As Long)
Cells(n).Interior.ColorIndex = 15: Cells(n).BorderAround xlContinuous 'Подвязка модуля для прогрессбара
End Sub |