读书人

Excel表中如果有些行是标识了颜色就

发布时间: 2012-07-29 15:26:14 作者: rapoo

Excel表中如果有些行是标识了颜色,就把它隐藏,VBA中如何实现
Sub hiddcolor()
If MsgBox("确定结束任务?", vbYesNo) = vbYes Then
ActiveWindow.LargeScroll ToRight:=-1
With Selection.Interior
.ColorIndex = 35
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
End If
End Sub
用上述函数来给excel行标识颜色为35,想写另一函数,sheet表从头到尾,如果发现行颜色为35,那么就隐藏该行,至到sheet表结束,如何实现?


[解决办法]
Sub aa()

Dim x As Long
Dim y As Integer

For x = 1 To 65536

If Rows(x).Interior.ColorIndex = 35 Then

Rows(x).Hidden = True

End If

Next x

End Sub

读书人网 >VBA

热点推荐