View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Claus Busch Claus Busch is offline
external usenet poster
 
Posts: 3,872
Default Case Select with 2 string conditions.

Hi Mark,

Am Tue, 8 Aug 2017 04:52:17 -0700 (PDT) schrieb Living the Dream:

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.


try:

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

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


Regards
Claus B.
--
Windows10
Office 2016