Sub Dan5Dong()
Const nRows As Long = 5
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Dim arrBAN(), lR As Long, r As Long, ws As Worksheet, firstRow As Long
Set ws = Sheet1
lR = LastRow(ws, ws.Range("G1"))
firstRow = 6
If lR <= firstRow Then Exit Sub
arrBAN = ws.Range("G7:H" & lR).Value: lR = UBound(arrBAN, 1)
For r = lR To 2 Step -1
If arrBAN(r, 1) <> "" And arrBAN(r - 1, 1) <> "" Then
If arrBAN(r, 1) <> arrBAN(r - 1, 1) Then
ws.Rows(r + firstRow & ":" & r + firstRow + nRows - 1).Insert Shift:=xlDown
End If
End If
Next r
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub
'---------------------'
Function LastRow(ws As Worksheet, cll As Range) As Long
ShowAllRows ws
LastRow = ws.Cells(ws.Rows.Count, cll.Column).End(xlUp).Row
End Function
'---------------------'
Sub ShowAllRows(ws As Worksheet)
ws.AutoFilterMode = False
ws.Cells.EntireRow.Hidden = False
End Sub