View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Living the Dream Living the Dream is offline
external usenet poster
 
Posts: 151
Default Case Select with 2 string conditions.

Hi All

Was hoping someone could assist with the correct syntax for the following as it doesnt work for me; essentially, if the 2 conditions match, then change colour of the cells.

Set myRng = Sheets("TMS DATA").Range("B6:B300")

For Each c In myRng
If c = "NEW" Then
For i = 6 To 300
myCrit = Sheets("TMS DATA").Cells(i, 25).Value And Sheets("TMS DATA").Cells(i, 34).Value
Select Case myCrit
Case "N" And "MCDH"
c.Offset(, -1).Resize(, 25).Interior.ColorIndex = 35
Case "N" And "MLDC"
c.Offset(, -1).Resize(, 25).Interior.Color = 15773696
Case "N" And "MNDC"
c.Offset(, -1).Resize(, 25).Interior.ColorIndex = 15
Case "N" And "MRDC"
c.Offset(, -1).Resize(, 25).Interior.ColorIndex = 39
Case "N" And "MSDC"
c.Offset(, -1).Resize(, 25).Interior.ColorIndex = 44
Case "N", "MVSC"
c.Offset(, -1).Resize(, 25).Interior.Color = 12611584
Case "N", "MSSS"
c.Offset(, -1).Resize(, 25).Interior.ThemeColor = xlThemeColorAccent6
Case Else
MsgBox "No Match Found"
End Select
Next i
End If
Next c

TIA
Mark