Dim col1(5) As Integer Dim col2 As Integer Sub ki092() Sheets("Sheet1").Select '各氏名の色取得 For i = 2 To 5 col1(i) = Cells(2, i).Interior.ColorIndex Cells(2, i).Copy Cells(10, i) Next '色別にコピ− For j = 3 To 7 For i = 2 To 5 col2 = Cells(j, i).Interior.ColorIndex For n = 2 To 5 If col2 = col1(n) Then Cells(j, i).Copy Cells(j + 8, n) Exit For End If Next Next Next '合計計算 Range(Cells(16, 2), Cells(16, 5)).Formula = "=SUM(B11:B15)" End Sub Sub ki092a() Sheets("Sheet1").Select Range("B10:E16").Select Selection.ClearContents Selection.Interior.ColorIndex = xlNone Range("A1").Select End Sub