Sub instab()
Dim flag As Boolean
Dim rs1 As String
Dim rs2 As String
flag = True
Range("A5:A6").Select
With Application.FindFormat.Font
.Subscript = False
.ColorIndex = 5
End With
While flag
Cells.Find(What:="小计", After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, MatchByte:=False, SearchFormat:=True).Activate
ActiveCell.Offset(1, 0).Select
Selection.EntireRow.Insert
Selection.EntireRow.Insert
ActiveCell.Offset(2, 0).Select
If ActiveCell.Offset(0, 0) = "" Then
flag = False
End If
Wend
End Sub
how use VBA in excel move active cell!
最新推荐文章于 2023-07-13 18:57:48 发布
博客给出一段VBA代码,用于在Excel中进行特定操作。代码通过循环查找包含“小计”的单元格,在其后插入两行,并持续操作直到遇到空单元格。代码中还设置了查找格式,如字体下标和颜色。
2437

被折叠的 条评论
为什么被折叠?



