Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

excel 2010 need help with figetr for blanks and set backgroud color 1

Status
Not open for further replies.

leo57

Programmer
Oct 28, 2013
33
US

the column I am looking in is M
I want to find both the letter"N" and blankc
this code works to filter the items bbut changes the backgroud color of all the cells to yellow
I tried to use this but it give object rrquired error
ActiveSheet.Range("M1:M500").AutoFilter Field:=ColumnAwarded, Criteria1:="=N", _
Operator:=xlOr, Criteria2:="="

Code:
ActiveSheet.Range("M1:M500").AutoFilter Field:=ColumnAwarded, Criteria1:="=N", _
        Operator:=xlOr, Criteria2:="="
    
    'Range("M6").Select
    ActiveSheet.UsedRange.Offset(1, 0).Resize(ActiveSheet.UsedRange.Rows.Count - 1).Rows.Select
    With Selection.Interior
        .Pattern = xlSolid
        .PatternColorIndex = xlAutomatic
        .Color = 65535
        '.TintAndShade = 0
        '.PatternTintAndShade = 0
    End With

 
hi,

what is the value of ColumnAwarded?

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 

You may try something simple like this:

Code:
Dim i As Integer

For i = 1 To 500
    If Range("M" & i).Value = "N" Or Trim(Range("M" & i).Value) = "" Then
        Range("M" & i).Interior.Color = vbYellow
    End If
Next i

End Sub



Have fun.

---- Andy
 
sweet Andrzejek, I like a pure and simple answer and code
have a star

 
I am sure there is a better, a ‘non-VBA’ way to do this, like Conditional Formatting.

Have fun.

---- Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top