|    | 
     ▼本山中 さん こんにちは 
 
他人のコードを読むのは大変なので、本山中さんのコードをいじってみました。 
 
本山中さんのコードを少し直すと、赤色にすること以外は、ほとんど出来ているのですね。 
ただ、ここから先が、ちょっと難しいですね。 
 
Sub 削除する() 
  Dim lastgyou As Integer 
  Dim i As Integer 
  Dim j As Integer 
  Dim atai As Integer 
  Dim zr As Integer 
  lastgyou = Cells(Rows.Count, 1).End(xlUp).Row 
  For i = 2 To lastgyou - 1 
   'atai = Cells(i, 2).Value 
    For j = i + 1 To lastgyou 
    Debug.Print j, i 
     If Cells(i, 2).Value = Cells(j, 2).Value Then 
      
      If Cells(i, 8).Value > Cells(j, 8).Value Then 
       Rows(i).Delete 
       'Rows(j).Cut 
       'Rows(i + 1).Insert Shift:=xlDown 
      End If 
       
      zr = Cells(i + 1, 8).Value - Cells(i, 8).Value 
        If zr > 0 Then 
         Rows(i + 1).Font.ColorIndex = 3 
        End If 
      i = i + 1 
     End If 
     
    Next j 
  Next i 
End Sub 
 | 
     
    
   |