Results 1 to 10 of 10

Thread: Selecting Row based on a Cell Value
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    Board Regular
    Join Date
    Jun 2019
    Posts
    102
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Selecting Row based on a Cell Value

    Hi all,

    I have data that is always changing. I need a macro that searches through column AH for the word "Black". If the word "Black" is found then that row gets selected and the font gets changed to red. I have to code for the red font, I just cant figure out how to select the specific row.

    Here is the code for the red font:
    Code:
    With Selection.Font
    .Color = -16776961
    .TintAndShade = 0
    End With
    Thank you in advance!

  2. #2
    MrExcel MVP
    Moderator
    Fluff's Avatar
    Join Date
    Jun 2014
    Location
    Chippenham
    Posts
    28,062
    Post Thanks / Like
    Mentioned
    467 Post(s)
    Tagged
    47 Thread(s)

    Default Re: Selecting Row based on a Cell Value

    Why not use conditional formatting, rather than a macro?
    Also do you want the font for the entire row to be red, or just that cell?
    - Posting Data try one of these tools
    - Posting guidelines, forum rules and terms of use
    - Read the FAQs

    Running Office 365 on Win 10

  3. #3
    Board Regular
    Join Date
    Jun 2019
    Posts
    102
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Selecting Row based on a Cell Value

    I didn't even think about that. I would I set up the rule for it? I haven't used conditional formatting before.

  4. #4
    MrExcel MVP
    Moderator
    Fluff's Avatar
    Join Date
    Jun 2014
    Location
    Chippenham
    Posts
    28,062
    Post Thanks / Like
    Mentioned
    467 Post(s)
    Tagged
    47 Thread(s)

    Default Re: Selecting Row based on a Cell Value

    Depends on the answer to my 2nd question
    - Posting Data try one of these tools
    - Posting guidelines, forum rules and terms of use
    - Read the FAQs

    Running Office 365 on Win 10

  5. #5
    Board Regular
    Join Date
    Jun 2019
    Posts
    102
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Selecting Row based on a Cell Value

    Haha didn't see that. I would like just the font to be red if possible.

  6. #6
    MrExcel MVP
    Moderator
    Fluff's Avatar
    Join Date
    Jun 2014
    Location
    Chippenham
    Posts
    28,062
    Post Thanks / Like
    Mentioned
    467 Post(s)
    Tagged
    47 Thread(s)

    Default Re: Selecting Row based on a Cell Value

    For the whole row, or just the cell in col AH?
    - Posting Data try one of these tools
    - Posting guidelines, forum rules and terms of use
    - Read the FAQs

    Running Office 365 on Win 10

  7. #7
    Board Regular
    Join Date
    Jun 2019
    Posts
    102
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Selecting Row based on a Cell Value

    The whole row should have red font, if the cell in AH has "Black" as a cell value.

  8. #8
    MrExcel MVP
    Moderator
    Fluff's Avatar
    Join Date
    Jun 2014
    Location
    Chippenham
    Posts
    28,062
    Post Thanks / Like
    Mentioned
    467 Post(s)
    Tagged
    47 Thread(s)

    Default Re: Selecting Row based on a Cell Value

    Ok, select your data & then in Conditional Formating > New rule > Use a formula & enter
    =$AH2="Black"
    Then select the format & Ok.
    This assumes that the first row you selected is row 2, if not change $AH2 to match the first selected row.
    - Posting Data try one of these tools
    - Posting guidelines, forum rules and terms of use
    - Read the FAQs

    Running Office 365 on Win 10

  9. #9
    Board Regular
    Join Date
    Jun 2019
    Posts
    102
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Selecting Row based on a Cell Value

    Quote Originally Posted by Fluff View Post
    Ok, select your data & then in Conditional Formating > New rule > Use a formula & enter
    =$AH2="Black"
    Then select the format & Ok.
    This assumes that the first row you selected is row 2, if not change $AH2 to match the first selected row.
    This worked perfectly. Thank you.

  10. #10
    MrExcel MVP
    Moderator
    Fluff's Avatar
    Join Date
    Jun 2014
    Location
    Chippenham
    Posts
    28,062
    Post Thanks / Like
    Mentioned
    467 Post(s)
    Tagged
    47 Thread(s)

    Default Re: Selecting Row based on a Cell Value

    You're welcome & thanks for the feedback
    - Posting Data try one of these tools
    - Posting guidelines, forum rules and terms of use
    - Read the FAQs

    Running Office 365 on Win 10

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •