find case in a certain cell

Trevor3007

Active Member
Joined
Jan 26, 2017
Messages
490
hi,

I use the following code
Code:
  Dim Changed As Range, Cell As Range  
Dim Clr As Long
   Set Changed = Intersect(Target, Range("m2:k300"))
  If Not Changed Is Nothing Then
    For Each Cell In Changed
       Select Case LCase(Cell.Value)
         Case "win10":       Clr = 35
         Case "no":        Clr = 55
         Case "issue":     Clr = 39
         Case "b i p":     Clr = 28
         Case "emailed":   Clr = 27
         Case "built":     Clr = 7
         Case "t b a":     Clr = 46
         Case "n / a":       Clr = 45
         Case "e u":       Clr = 22
         Case Else:        Clr = xlNone
      End Select
      Rows(Cell.Row).Resize(, Cell.Column).Interior.ColorIndex = Clr
    Next Cell
  End If
It works fine, but is it vaible for 'Case "n / a"' to pick up a cell ref ( IE sheetname VB , cell ref a2 'Test' )


Hoping this makes sense & thank you for your help.
KR
Trevor3007
 

Trevor3007

Active Member
Joined
Jan 26, 2017
Messages
490
I don't understand what that means.

Hi,

thanks for your reply & sorry for the mix up.


curerently where it stats in the code ' Case "n / a" ', "n / a" may have to change , and rather than having to open the VB , it would look to a cell ( ie 'A2) and and would use the text in that cell.


Hope this now makes sense
:confused:
KR
Trevor3007
 

Trevor3007

Active Member
Joined
Jan 26, 2017
Messages
490
Case LCase(Range("A2").Value): Clr = 45

many thanks , very much appreciated.

however, the 'text' is in sheet4(Vb) cell a2. can you help ?

KR
trevor3007
 

Forum statistics

Threads
1,078,435
Messages
5,340,250
Members
399,361
Latest member
Linford

Some videos you may like

This Week's Hot Topics

  • Problem with Radio Button's format control
    I am creating an employee evaluation template (a sample is below) Column A is the category Column B, C D, E and F will be ratings (unacceptable...
  • Last Display on userform to a Listbox
    [CODE=vba] lstdisplay.ColumnCount = 15 lstdisplay.RowSource = "A1:O600000" [/CODE] So when i do this it Displays everything on the sheet i am...
  • Rename and move files to a new location
    Dear all, I have an excel file with the following information. The actual file name is at column A but i want to rename it using the following...
  • Help with True/False Formula
    Hello! Am stumped how to fix this formula, in which my result returns 'True', but it should return False. =IF(AG2=True...
  • Clear extra characters from a provided range of cells
    Dear All, I have following code which gives me desired output to remove extra characters from a provided range. But it takes too much time when...
  • Help with Current and highest streaks
    Hi there, I've just joined the forum and this is my first post. I've already spent quite a bit of time searching the net and this forum for a...
Top