質問編集履歴
2
コード追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -154,24 +154,122 @@
|
|
154
154
|
|
155
155
|
```
|
156
156
|
|
157
|
-
グローバル
|
157
|
+
グローバル関数
|
158
|
-
|
158
|
+
|
159
|
-
Dim Sheet(200) As String
|
159
|
+
Dim Sheet(200) As String
|
160
|
-
|
160
|
+
|
161
|
-
Dim Sheet_path(200)
|
161
|
+
Dim Sheet_path(200)
|
162
162
|
|
163
163
|
Dim b As Long
|
164
164
|
|
165
|
+
Dim c As Long
|
166
|
+
|
167
|
+
Dim kekka
|
168
|
+
|
169
|
+
Dim neko
|
170
|
+
|
165
171
|
Dim a As Long
|
166
172
|
|
167
173
|
|
168
174
|
|
175
|
+
sub call
|
176
|
+
|
177
|
+
Call FileSearch("C:\Users\katou-ken\Documents\Document\25_設計書")
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
End sub
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
'SheetとSheet_pathに比較ファイルのデータとパスを入れる
|
186
|
+
|
187
|
+
Sub FileSearch(path As String)
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
Dim FSO As Object, Folder As Variant, File As Variant, buf As String, this As Worksheet
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
Set FSO = CreateObject("Scripting.FileSystemObject")
|
196
|
+
|
197
|
+
Set this = ThisWorkbook.Worksheets("イベント")
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
buf = Dir(path & "*サンプル.xls*")
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
Do While buf <> ""
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
Sheet(b) = buf
|
214
|
+
|
215
|
+
Sheet_path(b) = path
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
b = b + 1
|
220
|
+
|
221
|
+
buf = Dir()
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
If b > 178 Then
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
Call hikaku
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
End If
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
Loop
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
For Each Folder In FSO.GetFolder(path).SubFolders
|
246
|
+
|
247
|
+
Call FileSearch(Folder.path)
|
248
|
+
|
249
|
+
Next Folder
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
End Sub
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
|
264
|
+
|
169
265
|
Sub hikaku()
|
170
266
|
|
171
267
|
|
172
268
|
|
173
269
|
Set this = ThisWorkbook.Worksheets("イベント")
|
174
270
|
|
271
|
+
'MsgBox Sheet_path(4)
|
272
|
+
|
175
273
|
|
176
274
|
|
177
275
|
|
@@ -182,7 +280,7 @@
|
|
182
280
|
|
183
281
|
e = 2
|
184
282
|
|
185
|
-
c = 1
|
283
|
+
c = 1
|
186
284
|
|
187
285
|
d = 1
|
188
286
|
|
@@ -190,69 +288,91 @@
|
|
190
288
|
|
191
289
|
|
192
290
|
|
193
|
-
this_line = this.Cells(Rows.Count, 7).End(xlUp).Row 'G列の
|
291
|
+
this_line = this.Cells(Rows.Count, 7).End(xlUp).Row 'AファイルG列の最終行の行番号
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
292
|
+
|
293
|
+
|
294
|
+
|
295
|
+
|
296
|
+
|
199
|
-
Do While this_line > a 'AファイルのG列の
|
297
|
+
Do While this_line > a 'AファイルのG列の末端までループ
|
200
|
-
|
201
|
-
|
202
|
-
|
298
|
+
|
299
|
+
|
300
|
+
|
203
|
-
target = this.Cells(e, 7).Value '
|
301
|
+
target = this.Cells(e, 7).Value 'AファイルG列の文字を取得
|
204
|
-
|
205
|
-
|
206
|
-
|
302
|
+
|
303
|
+
|
304
|
+
|
207
|
-
Do While UBound(Sheet) > d '配列の要素数分だけ
|
305
|
+
Do While UBound(Sheet) > d '配列の要素数分だけ取得
|
208
|
-
|
209
|
-
|
210
|
-
|
306
|
+
|
307
|
+
|
308
|
+
|
211
|
-
filename = Sheet(c)
|
309
|
+
filename = Sheet(c)
|
212
|
-
|
213
|
-
|
214
|
-
|
310
|
+
|
311
|
+
|
312
|
+
|
313
|
+
|
314
|
+
|
315
|
+
|
316
|
+
|
317
|
+
|
318
|
+
|
215
|
-
'
|
319
|
+
'現在考え中の処理2と処理1
|
216
|
-
|
320
|
+
|
217
|
-
|
321
|
+
If target Like "初期" Then
|
322
|
+
|
323
|
+
|
324
|
+
|
218
|
-
|
325
|
+
Call IsContained(target, filename)
|
326
|
+
|
327
|
+
|
328
|
+
|
329
|
+
If kekka = True Then
|
330
|
+
|
331
|
+
this.Cells(e, 8).Value = "一致"
|
332
|
+
|
333
|
+
Else
|
334
|
+
|
219
|
-
this.Cells(e, 8).Value = "一致なし"
|
335
|
+
this.Cells(e, 8).Value = "一致なし"
|
336
|
+
|
337
|
+
End If
|
220
338
|
|
221
339
|
Else
|
222
340
|
|
223
|
-
this.Cells(e, 8).Value = "一致"
|
224
|
-
|
225
|
-
|
341
|
+
End If
|
226
|
-
|
227
|
-
|
228
|
-
|
342
|
+
|
343
|
+
|
344
|
+
|
229
|
-
If Not target Like "初期"
|
345
|
+
If Not target Like "初期" Then
|
346
|
+
|
230
|
-
|
347
|
+
Call shori(target, filename)
|
348
|
+
|
349
|
+
|
350
|
+
|
231
|
-
|
351
|
+
If neko = True Then
|
232
352
|
|
233
353
|
this.Cells(e, 8).Value = "一致"
|
234
354
|
|
355
|
+
|
356
|
+
|
235
|
-
|
357
|
+
Else
|
358
|
+
|
236
|
-
|
359
|
+
this.Cells(e, 8).Value = "不一致"
|
360
|
+
|
237
|
-
E
|
361
|
+
End If
|
238
|
-
|
239
|
-
|
240
362
|
|
241
363
|
Else
|
242
364
|
|
243
|
-
this.Cells(e, 8).Value = "不一致"
|
244
|
-
|
245
|
-
|
246
|
-
|
247
365
|
End If
|
248
366
|
|
249
|
-
|
367
|
+
|
368
|
+
|
369
|
+
|
250
370
|
|
251
371
|
d = d + 1
|
252
372
|
|
253
373
|
c = c + 1
|
254
374
|
|
255
|
-
|
375
|
+
|
256
376
|
|
257
377
|
Loop
|
258
378
|
|
@@ -260,7 +380,7 @@
|
|
260
380
|
|
261
381
|
c = 2
|
262
382
|
|
263
|
-
|
383
|
+
e = e + 1
|
264
384
|
|
265
385
|
a = a + 1
|
266
386
|
|
@@ -270,21 +390,23 @@
|
|
270
390
|
|
271
391
|
End Sub
|
272
392
|
|
273
|
-
|
393
|
+
|
274
|
-
|
394
|
+
|
275
|
-
Function IsContained(target, filename) As Boolean
|
395
|
+
Function IsContained(target, filename) As Boolean
|
276
|
-
|
277
|
-
|
278
|
-
|
396
|
+
|
397
|
+
|
398
|
+
|
399
|
+
|
400
|
+
|
279
|
-
path = Sheet_path(
|
401
|
+
path = Sheet_path(c)
|
280
|
-
|
281
|
-
|
402
|
+
|
403
|
+
|
282
404
|
|
283
405
|
Set open_file = Workbooks.Open(filename:=path & "\" & filename, UpdateLinks:=False)
|
284
406
|
|
285
407
|
|
286
408
|
|
287
|
-
this_line = Workbooks(filename).Worksheets("説明").Cells(Rows.Count, 81).End(xlUp).Row
|
409
|
+
this_line = Workbooks(filename).Worksheets("説明").Cells(Rows.Count, 81).End(xlUp).Row
|
288
410
|
|
289
411
|
|
290
412
|
|
@@ -300,11 +422,7 @@
|
|
300
422
|
|
301
423
|
|
302
424
|
|
303
|
-
Do While this_line / 2 > i '
|
425
|
+
Do While this_line / 2 > i '最終行までループ
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
426
|
|
309
427
|
|
310
428
|
|
@@ -312,33 +430,33 @@
|
|
312
430
|
|
313
431
|
|
314
432
|
|
315
|
-
|
316
|
-
|
317
|
-
If Workbooks(filename).Worksheets("説明").Cells(j, 81).Value Like target Then 'Aファイル
|
433
|
+
If Workbooks(filename).Worksheets("説明").Cells(j, 81).Value Like target Then '比較ファイルにAファイルと同じデータが存在するなら
|
318
|
-
|
434
|
+
|
435
|
+
|
436
|
+
|
437
|
+
|
438
|
+
|
319
|
-
|
439
|
+
kekka = True
|
320
|
-
|
321
|
-
|
440
|
+
|
441
|
+
|
322
442
|
|
323
443
|
Exit Do
|
324
444
|
|
325
|
-
|
326
|
-
|
327
|
-
|
445
|
+
|
328
446
|
|
329
447
|
Else
|
330
448
|
|
331
|
-
|
449
|
+
|
332
450
|
|
333
451
|
i = i + 1
|
334
452
|
|
335
453
|
j = j + 2
|
336
454
|
|
337
|
-
|
455
|
+
|
338
456
|
|
339
457
|
End If
|
340
458
|
|
341
|
-
|
459
|
+
kekka = False
|
342
460
|
|
343
461
|
Loop
|
344
462
|
|
@@ -352,4 +470,94 @@
|
|
352
470
|
|
353
471
|
End Function
|
354
472
|
|
473
|
+
|
474
|
+
|
475
|
+
|
476
|
+
|
477
|
+
|
478
|
+
|
479
|
+
Function shori(target, filename) As Boolean
|
480
|
+
|
481
|
+
|
482
|
+
|
483
|
+
|
484
|
+
|
485
|
+
path = Sheet_path(c)
|
486
|
+
|
487
|
+
|
488
|
+
|
489
|
+
Set open_file = Workbooks.Open(filename:=path & "\" & filename, UpdateLinks:=False)
|
490
|
+
|
491
|
+
|
492
|
+
|
493
|
+
this_line = Workbooks(filename).Worksheets("説明").Cells(Rows.Count, 81).End(xlUp).Row
|
494
|
+
|
495
|
+
|
496
|
+
|
497
|
+
i = 1
|
498
|
+
|
499
|
+
j = 10
|
500
|
+
|
501
|
+
|
502
|
+
|
503
|
+
|
504
|
+
|
505
|
+
Application.ScreenUpdating = False
|
506
|
+
|
507
|
+
|
508
|
+
|
509
|
+
Do While this_line / 2 > i 'filename???I?s-9 =i ??(?w?????t?@?C????S?s?????????????[?v)
|
510
|
+
|
511
|
+
|
512
|
+
|
513
|
+
'Set open_file = Workbooks.Open(filename:=path & "\" & filename, UpdateLinks:=False)
|
514
|
+
|
515
|
+
|
516
|
+
|
517
|
+
ThisWorkbook.Activate
|
518
|
+
|
519
|
+
|
520
|
+
|
521
|
+
If Workbooks(filename).Worksheets("説明").Cells(j, 81).Value Like target Then '
|
522
|
+
|
523
|
+
|
524
|
+
|
525
|
+
|
526
|
+
|
527
|
+
neko = True
|
528
|
+
|
529
|
+
|
530
|
+
|
531
|
+
Exit Do
|
532
|
+
|
533
|
+
|
534
|
+
|
535
|
+
Else
|
536
|
+
|
537
|
+
|
538
|
+
|
539
|
+
i = i + 1
|
540
|
+
|
541
|
+
j = j + 2
|
542
|
+
|
543
|
+
|
544
|
+
|
545
|
+
End If
|
546
|
+
|
547
|
+
neko = False
|
548
|
+
|
549
|
+
Loop
|
550
|
+
|
551
|
+
Workbooks(filename).Close
|
552
|
+
|
553
|
+
|
554
|
+
|
555
|
+
|
556
|
+
|
557
|
+
Application.ScreenUpdating = True
|
558
|
+
|
559
|
+
End Function
|
560
|
+
|
561
|
+
|
562
|
+
|
355
563
|
```
|
1
l
test
CHANGED
File without changes
|
test
CHANGED
@@ -130,9 +130,9 @@
|
|
130
130
|
|
131
131
|
2||テスト|一致|
|
132
132
|
|
133
|
-
3||
|
133
|
+
3||API|不一致|
|
134
|
-
|
134
|
+
|
135
|
-
4||
|
135
|
+
4||LINE|不一致|
|
136
136
|
|
137
137
|
5||デバッグ|一致|
|
138
138
|
|