Want this code to work if any part of answer appears (Joe, Analyst, not just Analyst)

  • I have a formula that pulls from a list of employees via their ID Number.
    Employees that are Analysts have Analyst next to their name (Joe Jones, Analyst).
    This code only works if the answer is "Analyst"
    How can I get it to work with any employee that has Analyst in their Name?
    This way I don't have to change the code for every employee.
    Thanks



    Crosspost
    http://www.mrexcel.com/forum/e…yst-not-just-analyst.html

  • Re: Want this code to work if any part of answer appears (Joe, Analyst, not just Anal


    MODERATOR NOTICE: This topic has also been posted on other sites and may already have an answer elsewhere. Please take this into consideration when answering this question

    *


    Also, please edit your thread title so it accurately and concisely describes your problem.


    Do not ignore these requests like you did in your other thread.

  • Re: Want this code to work if any part of answer appears (Joe, Analyst, not just Anal


    Hi, Kusaywa,


    If you want your macro to work for any employee with "analyst" in the cell, try modifying your code as follows:


  • Re: Want this code to work if any part of answer appears (Joe, Analyst, not just Anal


    That did it... Thanks
    What I noticed is if you mistakenly put in Analyst and changed it, it stayed red.
    I added the line
    This is if the user isn't an Analyst but can still make entries.

    Code
    ElseIf InStr(1, UCase(cell.Value), "") <> 0 Then 
                cell.EntireRow.Font.ColorIndex = 1

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!