+ Reply to Thread
Results 1 to 12 of 12

How can I highlight all rows that have a cell with a certain value using VBA?

  1. #1
    Registered User
    Join Date
    02-09-2013
    Location
    New Jersey, US
    MS-Off Ver
    Excel 2010
    Posts
    13

    How can I highlight all rows that have a cell with a certain value using VBA?

    I want all rows which say either ADULT SWIM, BET, COMEDY, MTV, NBC, TBS, or VH1 to be highlighted in light grey and also have all content in the row bolded. All using VBA. Thanks!!
    Attached Files Attached Files

  2. #2
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: How can I highlight all rows that have a cell with a certain value using VBA?

    I can't seem to find any of the words you mentioned.

  3. #3
    Registered User
    Join Date
    02-09-2013
    Location
    New Jersey, US
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: How can I highlight all rows that have a cell with a certain value using VBA?

    The words are in column B. Not all of them are in there, but some of them are, such as NBC and VH1.
    The macro should look through column B to find the words.

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: How can I highlight all rows that have a cell with a certain value using VBA?

    This should do, but I do not know the color of grey, so used red instead

    Please Login or Register  to view this content.
    Last edited by AB33; 02-15-2013 at 06:37 PM.

  5. #5
    Registered User
    Join Date
    02-09-2013
    Location
    New Jersey, US
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: How can I highlight all rows that have a cell with a certain value using VBA?

    Thank you so much, but is there a way to make it highlight and bold the entire table's row if its cell in column B has one of those certain words?

  6. #6
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: How can I highlight all rows that have a cell with a certain value using VBA?

    You mean the entire row
    Change these two lines of the code

    Please Login or Register  to view this content.
    INTO
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    02-09-2013
    Location
    New Jersey, US
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: How can I highlight all rows that have a cell with a certain value using VBA?

    I meant the entire row of the table. So, I would like the first four cells of the row to be highlighted and bolded. Is that possible?

  8. #8
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: How can I highlight all rows that have a cell with a certain value using VBA?

    "first four cells of the row to be highlighted and bolded"
    How? The searched items on not in consective order. For e.g, if the code finds MTV in row 40, how do you want to be highlighted the entire table.
    Or, do you mean when the search finds MTV, you need to highlight 4 rows. Please explain.

  9. #9
    Registered User
    Join Date
    02-09-2013
    Location
    New Jersey, US
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: How can I highlight all rows that have a cell with a certain value using VBA?

    I am sorry that I'm not good at explaining things. I would like for the rows being highlighted to only go from cell A to cell D instead of the row going on forever.

  10. #10
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: How can I highlight all rows that have a cell with a certain value using VBA?

    So,instead of the enitre row, you want to highlight from A-D, once a search is find in column B. is this right? See amended code no 4.
    Last edited by AB33; 02-15-2013 at 06:38 PM.

  11. #11
    Registered User
    Join Date
    02-09-2013
    Location
    Bratislava
    MS-Off Ver
    Excel 2003, 2007, 2010
    Posts
    11

    Re: How can I highlight all rows that have a cell with a certain value using VBA?

    Try this:

    Please Login or Register  to view this content.
    Last edited by PushCar; 02-15-2013 at 07:01 PM.

  12. #12
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: How can I highlight all rows that have a cell with a certain value using VBA?

    Pushcar,
    Please use code tags with your code.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1