我需要在每個組下面插入一個包含總計和分頁符的行。在每個組下插入行總數
我嘗試了以下插入行,但它插入了多行,當我只想要一個。
Sub macro()
Dim sh1 As Worksheet
Dim i As Long, lastrow1 As Long
Set sh1 = Worksheets("Sheet1")
lastrow1 = sh1.Cells.SpecialCells(xlCellTypeLastCell).Row
For i = 1 To lastrow1
If sh1.Cells(i, "A").Value = "sell" Then
sh1.Cells(i, "A").EntireRow.Insert
End If
Next i
End Sub