Sub 辞書コードを取得()
Dim intCount_JISYO_CD As Integer
Dim intUUNo_JISYO_CD As Integer
intCount_JISYO_CD = 3
intUUNo_JISYO_CD = 2
'辞書コードをSheetn5に作成します、重複の場合スキップします
Do While Len(Worksheets("Sheet2").Cells(intCount_JISYO_CD, 13).Value) > 1
Set Obj = Worksheets("Sheet5").Cells.Find(Worksheets("Sheet2").Cells(intCount_JISYO_CD, 13).Value, LookAt:=xlWhole)
If Obj Is Nothing Then
Worksheets("Sheet5").Cells(intUUNo_JISYO_CD, 1).Value = Worksheets("Sheet2").Cells(intCount_JISYO_CD, 13).Value
intUUNo_JISYO_CD = intUUNo_JISYO_CD + 1
End If
intCount_JISYO_CD = intCount_JISYO_CD + 1
Loop
'Sheet5に作成された辞書コードを昇準にソートします
'Worksheets("Sheet5").Active
Worksheets("Sheet5").Range(Cells(1, 1), Cells(intUUNo_JISYO_CD, 1)).Sort Key1:=Worksheets("Sheet5").Cells(1, 1), order1:=xlAscending
End Sub
Sub 辞書コードが存在しない部品()
Dim intCount_JISYO_CD As Integer
Dim intNum_Record As Integer
intCount_JISYO_CD = 3
intNum_Record = 3
'辞書コードが存在しない部品をSheet6に作成します
Do While Len(Worksheets("Sheet2").Cells(intCount_JISYO_CD, 13).Value) > 1
If Worksheets("Sheet2").Cells(intCount_JISYO_CD, 13).Value = "C5416" Or Worksheets("Sheet2").Cells(intCount_JISYO_CD, 13).Value = "C5860" Then
Worksheets("Sheet2").Cells(intCount_JISYO_CD, 13).EntireRow.Copy
Worksheets("Sheet6").Cells(intNum_Record, 1).EntireRow.Insert
intNum_Record = intNum_Record + 1
End If
intCount_JISYO_CD = intCount_JISYO_CD + 1
Loop
End Sub
Sub 重複レコードを削除します()
Dim intRows As Integer
Dim intUniqueRows As Integer
intRows = 1
intUniqueRows = 1
Do While Len(Worksheets("Sheet7").Cells(intRows, 1).Value) > 1
Set Obj = Worksheets("Sheet9").Cells.Find(Worksheets("Sheet7").Cells(intRows, 1).Value, LookAt:=xlWhole)
If Obj Is Nothing Then
Worksheets("Sheet7").Cells(intRows, 1).EntireRow.Copy
Worksheets("Sheet9").Cells(intUniqueRows, 1).EntireRow.Insert
intUniqueRows = intUniqueRows + 1
End If
intRows = intRows + 1
Loop
End Sub