ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to using Range ? (https://www.excelbanter.com/excel-programming/357214-how-using-range.html)

moon[_3_]

How to using Range ?
 
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




All times are GMT +1. The time now is 01:30 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com