我有一个工作宏,每6行添加一个空行,它工作的很棒!我有一个问题,虽然,这是很简单,但它不工作:S 我希望这些颜色新行颜色:.TintAndShade = -0.249977111117893和H.如何在宏中着色行
只有细胞列A之间我不知道在哪里在此代码中添加此代码。有人能帮我吗?
Dim NumRowsToInsert As Long
Dim RowIncrement As Long
Dim ws As Excel.Worksheet
Dim LastRow As Long
Dim LastEvenlyDivisibleRow
Dim i As Long
NumRowsToInsert = 1
RowIncrement = 6
Set ws = ActiveSheet
With ws
LastRow = .Range("A" & .Rows.Count).End(xlUp).Row
LastEvenlyDivisibleRow = Int(LastRow/RowIncrement) * RowIncrement
If LastEvenlyDivisibleRow = 0 Then
Exit Sub
End If
Application.ScreenUpdating = False
For i = LastEvenlyDivisibleRow To 1 Step -RowIncrement
.Range(i & ":" & i + (NumRowsToInsert - 1)).Insert xlShiftDown
Next i
End With
Application.ScreenUpdating = True
End Sub
非常感谢!这工作。非常感激! @vacip – BMRobin