Excel 删除所有“;“无填充”;排
这可以删除黄色(索引6),但Excel 删除所有“;“无填充”;排,excel,vba,excel-2010,Excel,Vba,Excel 2010,这可以删除黄色(索引6),但0不会清除“无填充”行,有什么想法吗 Sub deleterow() Dim i As Long, j As Long Dim delRange As Range With ActiveSheet For i = 7 To 1200 '<~~ Row 7 to 1200 For j = 1 To 180 '<~~ Col A to end of last dealer If .Cells(i, j).Int
0
不会清除“无填充”行,有什么想法吗
Sub deleterow()
Dim i As Long, j As Long
Dim delRange As Range
With ActiveSheet
For i = 7 To 1200 '<~~ Row 7 to 1200
For j = 1 To 180 '<~~ Col A to end of last dealer
If .Cells(i, j).Interior.ColorIndex = 0 Then '0=No Fill
If delRange Is Nothing Then
Set delRange = .Cells(i, j)
Else
Set delRange = Union(delRange, .Cells(i, j))
End If
Exit For
End If
Next j
Next i
End With
If Not delRange Is Nothing Then delRange.EntireRow.Delete
End Sub
子删除行()
我和我一样长,我和我一样长
范围
使用ActiveSheet
对于i=7到1200'来说,试一试怎么样
.Cells(i, j).Interior.ColorIndex = -4142
-4142是xlColorIndexNone的值,xlColorIndex枚举的值之一。如果您不确定该数字,则可以始终将范围的interior.colorindex置于Msgbox中