我有一個工作宏,每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