Sub test() Dim i As Integer Dim st_flag As Byte Dim range1 As Range
st_flag = 0 i = 3 Do While Cells(i, 1).Value <> "" If (st_flag = 1) Then If (Cells(i, 1).Value <> Cells(i - 1, 1).Value) Then Range(Cells(i, 1), Cells(i, 6)).Borders(xlEdgeTop).LineStyle = xlMedium End If Else st_flag = 1 ''最初の1セルは比較をしない End If i = i + 1 Loop End Sub