Sub sdsdsd() ii = 0 s01 = 0 s02 = 0 For i = 47 To 100 If Range("B" & i).Value = 1 And s01 = 0 Then s01 = Range("G" & i).Value ii = i End If If Range("B" & i).Value = 2 And s02 = 0 Then s02 = Range("H" & i).Value '68---------------- If Range("B" & i).Value = 68 Then i68 = i End If If Range("B" & i).Value = "68.01" Or _ Range("B" & i).Value = "68.02" Or _ Range("B" & i).Value = "68.03" Or _ Range("B" & i).Value = "68.04" Or _ Range("B" & i).Value = "68.05" Or _ Range("B" & i).Value = "68.06" Or _ Range("B" & i).Value = "68.07" Or _ Range("B" & i).Value = "68.08" Or _ Range("B" & i).Value = "68.09" Or _ Range("B" & i).Value = "68.10" Or _ Range("B" & i).Value = "68.11" Then v68G = v68G + Range("G" & i) v68H = v68H + Range("H" & i) End If '69---------------- If Range("B" & i).Value = 69 Then i69 = i End If If Range("B" & i).Value = "69.01" Or _ Range("B" & i).Value = "69.02" Or _ Range("B" & i).Value = "69.03" Or _ Range("B" & i).Value = "69.04" Or _ Range("B" & i).Value = "69.05" Or _ Range("B" & i).Value = "69.06" Or _ Range("B" & i).Value = "69.07" Or _ Range("B" & i).Value = "69.08" Or _ Range("B" & i).Value = "69.09" Or _ Range("B" & i).Value = "69.10" Or _ Range("B" & i).Value = "69.11" Then v69G = v69G + Range("G" & i) v69H = v69H + Range("H" & i) End If Next i Range("I" & ii) = s01 - s02 Range("I" & i68) = v68G Range("J" & i68) = v68H Range("K" & i68) = v68G - v68H Range("I" & i69) = v69G Range("J" & i69) = v69H Range("K" & i69) = v69G - v69H End Sub