Hello
I Know this must have been arswered many times before, but I can't find it.
Is it possible in VBA to check if cell meets the given conditions for formatting.
ex. if a range of cells have been formatted to be interior.colorindex=15 (grey) if they are above 10, is it then possible to check the color in vba??
I've tried to make a makro that would only select the cells in an area that meet the conditions, but I failed somewhere.
Sub Macro2()
Dim Same As Range
Firsttime = True
test = Selection.Interior.PatternColorIndex
Selection.SpecialCells(xlCellTypeSameFormatConditions).Select
For Each c In Selection.Cells
If c.Interior.PatternColorIndex <> test Then
If Firsttime = True Then
Set Same = Range(c.Address)
Firsttime = False
Else: Set Same = Application.Union(Range(c.Address), Same)
End If
End If
Next
Same.Select
End Sub
TIA Tommy
I Know this must have been arswered many times before, but I can't find it.
Is it possible in VBA to check if cell meets the given conditions for formatting.
ex. if a range of cells have been formatted to be interior.colorindex=15 (grey) if they are above 10, is it then possible to check the color in vba??
I've tried to make a makro that would only select the cells in an area that meet the conditions, but I failed somewhere.
Sub Macro2()
Dim Same As Range
Firsttime = True
test = Selection.Interior.PatternColorIndex
Selection.SpecialCells(xlCellTypeSameFormatConditions).Select
For Each c In Selection.Cells
If c.Interior.PatternColorIndex <> test Then
If Firsttime = True Then
Set Same = Range(c.Address)
Firsttime = False
Else: Set Same = Application.Union(Range(c.Address), Same)
End If
End If
Next
Same.Select
End Sub
TIA Tommy