Excel VBA Macro: Change Row Color (Based on Cell Value)

preview_player
Показать описание
Excel VBA Macro: Change Row Color (Based on Cell Value) - We create a macro that colors rows based on cell value with specific text. If you ever need to automatically color cells in all rows that contain specific value in an excel worksheet, you can use this code to highlight rows with whatever color you want.

In this example, the code searches for a specific value in a designated column, then highlights that entire row or portion of the row, if the cell contains the value you are searching for. The macro counts the number of total rows in the data-set, then goes down each row searching for the specific value in order to color that row, until it reaches the bottom of the range.

Data used in this video:

#ExcelVBA #ExcelMacro
Рекомендации по теме
Комментарии
Автор

thanks dawg
literally could not find anything on how to highlight a certain set of columns instead of EntireRow

my grade and I appreciate it

patrickstar
Автор

Hello friend, thanks for doing this tutorial, I was doing my information technology homework and you got me out of a hurry, Greetings from Mexico City

delecemx
Автор

This is simple and straight forward code. Save me a lot of time. Thanks

balooganesan
Автор

Bro, great post...I cannibalized your VBA code and tweaked it to give me color scale conditional formatting based on cell text and clear conditional formatting. I use buttons to execute conditional formatting or clear formatting. It works like a charm. thanks.

__-lvpz
Автор

Excellent Mate.... May the Power be with you . It helped on short notice.

TechnoQuark
Автор

Hi, after watching your video, I was able to modify your code to change the color of the Font in an entire row, instead of changing the entire row color (based on a cell value). It was very easy to understand. I was struggling to find the right way to do it.

thomasekiert
Автор

Thank you for the code and the thorough explanation! :)

haziqfirdaus
Автор

Thanks for this video. Helped me tons at my job

alastairevicente
Автор

So if the value changes does it go back to the original formatted color?

keithmcgee
Автор

How about the row number how to put color on these numbers, this row number located at the leftmost side of this excel interface.... i hope you read this request... Thank for a nice video...

BARTLANTV
Автор

Hey. Thanks for the video. Just wondering if you can set this up to run auto when a new data is enter. Thanks

xtrunggax
Автор

Hey, just came across your video, I'm trying to accomplish a method related to this for my worksheet. Instead I want to override colors in a row when input value is put in specific cells. I tried conditional formatting but this didn't work for. Hopefully you can get back to me and i can fully explain what I'm trying to do

rurkuz
Автор

Is there any way to use this format for multiple colors? I have 4 criteria that I need to highlight and I can't figure out how to color all 4 cleanly.

pseudo
Автор

Hey man, this is very helpful, but I got one problem, now when I'm doing the code, I need the value to be a certain type of text in a cell, so say I'm trying to color the cel with "Stimulation pumped acid", I just want the macro to recognize Stimulation only and not the rest of the cell values. The issue is when I input:
Do While i <= count
If Cells(i, 5).Value = Stimulation Then
Range(Cells(i, 5), Cells(i, 13)).Interior.color = RGB(67, 195, 233)

It will take stimulation as a value and apply it for the rest of the rows, so any row with any text in it will be counted as a value.. Is there anyway you can help with this issue..?

Thanks in advance,

husseinmourad
Автор

Hi, I'm trying to do something similar to what you have done just that I have a separate input table, so eg. in a cell I would input "701" and in the next "707", and I'm trying to make it so that only the rows with these two values would be highlighted in the results table. Do you have any suggestions on how I should approach this? Great video by the way!

myhousebigbigo.o
Автор

Hi. I'm trying to make a macro to highlight the cells in another sheet containing the same text in a previous sheet. I can't incorporate the text in the code because it changes everyday (it's a date). Do you have a code that will color the row in another sheet based on the text inside the cell from a different sheet?

empresscarrot