- ベストアンサー
結果登録シートから別シートのリストへ登録結果を転記
結果登録シートから別シートのリストへ登録結果を転記したい。リストは20000件あり 毎日100件程度結果登録する。 結果登録シート 一連番号 名前 結果 実施日 1 いとう 済 9月10日 ←A5から 100件ほど登録 リストシート 一連番号 名前 結果 実施日 1 いとう ←A10から 20000件 2 さとう 20000 すとう よろしくお願いいたします。
結果登録シートから別シートのリストへ登録結果を転記したい。リストは20000件あり 毎日100件程度結果登録する。 結果登録シート 一連番号 名前 結果 実施日 1 いとう 済 9月10日 ←A5から 100件ほど登録 リストシート 一連番号 名前 結果 実施日 1 いとう ←A10から 20000件 2 さとう 20000 すとう よろしくお願いいたします。
お礼
ありがとうございます。 いろいろ検索のうえマクロが完成しました。補足入力欄に作成したマクロを入力しました。
補足
Sub 一連番号からデータ把握() For n = 1 To 20000 If Sheets("結果登録").Cells(n + 4, 1) = "" Then GoTo 1 Sheets("結果登録").Cells(n + 4, 2) = Application.VLookup(Sheets("結果登録").Cells(n + 4, 1), Sheets("リスト").Range("A10:Z20000"), 2, False) Sheets("結果登録").Cells(n + 4, 3) = Application.VLookup(Sheets("結果登録").Cells(n + 4, 1), Sheets("リスト").Range("A10:Z20000"), 3, False) Sheets("結果登録").Cells(n + 4, 4) = Application.VLookup(Sheets("結果登録").Cells(n + 4, 1), Sheets("リスト").Range("A10:Z20000"), 4, False) Sheets("結果登録").Cells(n + 4, 5) = Application.VLookup(Sheets("結果登録").Cells(n + 4, 1), Sheets("リスト").Range("A10:Z20000"), 5, False) Sheets("結果登録").Cells(n + 4, 6) = Application.VLookup(Sheets("結果登録").Cells(n + 4, 1), Sheets("リスト").Range("A10:Z20000"), 6, False) Sheets("結果登録").Cells(n + 4, 7) = Application.VLookup(Sheets("結果登録").Cells(n + 4, 1), Sheets("リスト").Range("A10:AZ2000"), 7, False) Sheets("結果登録").Cells(n + 4, 8) = Application.VLookup(Sheets("結果登録").Cells(n + 4, 1), Sheets("リスト").Range("A10:AZ2000"), 8, False) If IsError(Application.VLookup(Sheets("結果登録").Cells(n + 4, 1), Sheets("リスト").Range("A10:Z20000"), 2, False)) Then Sheets("結果登録").Cells(n + 4, 2) = "該当なし" End If If IsError(Application.VLookup(Sheets("結果登録").Cells(n + 4, 1), Sheets("リスト").Range("A10:Z20000"), 3, False)) Then Sheets("結果登録").Cells(n + 4, 3) = "該当なし" End If If IsError(Application.VLookup(Sheets("結果登録").Cells(n + 4, 1), Sheets("リスト").Range("A10:Z20000"), 4, False)) Then Sheets("結果登録").Cells(n + 4, 4) = "該当なし" End If If IsError(Application.VLookup(Sheets("結果登録").Cells(n + 4, 1), Sheets("リスト").Range("A10:Z20000"), 5, False)) Then Sheets("結果登録").Cells(n + 4, 5) = "該当なし" End If If IsError(Application.VLookup(Sheets("結果登録").Cells(n + 4, 1), Sheets("リスト").Range("A10:Z20000"), 6, False)) Then Sheets("結果登録").Cells(n + 4, 6) = "該当なし" End If If IsError(Application.VLookup(Sheets("結果登録").Cells(n + 4, 1), Sheets("リスト").Range("A10:Z20000"), 7, False)) Then Sheets("結果登録").Cells(n + 4, 7) = "該当なし" End If If IsError(Application.VLookup(Sheets("結果登録").Cells(n + 4, 1), Sheets("リスト").Range("A10:Z20000"), 8, False)) Then Sheets("結果登録").Cells(n + 4, 8) = "該当なし" End If Next n 1 Sheets("結果登録").Cells(1, 18) = "=COUNTIF(B5:B20000,""該当なし"")" If Sheets("結果登録").Cells(1, 18) > 0 Then MsgBox "一連番号に誤入力があります。再度入力しマクロ実行願います!!" & Sheets("結果登録").Cells(1, 18) & "個" End If Sheets("結果登録").Cells(1, 19) = "=COUNTA(G5:G20000)" If Sheets("結果登録").Cells(1, 19) > 0 Then MsgBox "既に結果登録済の番号があります!! " & Sheets("結果登録").Cells(1, 19) & "個" End If Sheets("結果登録").Select Range("I4").Select End Sub Sub 一連番号へ結果登録() For n = 1 To 20000 If Sheets("リスト").Cells(n + 9, 1) = "" Then GoTo 1 If Sheets("リスト").Cells(n + 9, 7) = "" Then Sheets("リスト").Cells(n + 9, 7) = Application.VLookup(Sheets("リスト").Cells(n + 9, 1), Sheets("結果登録").Range("$A$5:$Z$2000"), 7, False) End If If IsError(Sheets("リスト").Cells(n + 9, 7)) Then Sheets("リスト").Cells(n + 9, 7) = "" End If If Sheets("リスト").Cells(n + 9, 8) = "" Then Sheets("リスト").Cells(n + 9, 8) = Application.VLookup(Sheets("リスト").Cells(n + 9, 1), Sheets("結果登録").Range("$A$5:$Z$2000"), 8, False) End If If IsError(Sheets("リスト").Cells(n + 9, 8)) Then Sheets("リスト").Cells(n + 9, 8) = "" End If Next n 1 MsgBox "結果登録終了しました。" End Sub