How to using Range ?

M

moon

How to using Range selection to check cell have formated using "color
index=35".

Sub Macro1()
With Selection.Interior
.ColorIndex = 35
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
End Sub

Step1 . Select a area by rows.
Step2. Run sub ErCheckColor

How to write below code to check cell have formated with color index =35, if
not selected row set "0" otherwise set "1".

Sub ErCheckColor()
areaCount = Selection.Areas.Count
If areaCount <= 1 Then
MsgBox "The selection contains " & _
Selection.Rows.Count & " rows."

Else
I = 1
For Each a In Selection.Areas
MsgBox "Area " & I & " of the selection contains " & _
a.Rows.Count & " rows."
I = I + 1

Next a
End If

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top