Highlight blank cells in the column named "Model" red (not using conditional formatting)

VBAProIWish

Well-known Member
Joined
Jul 6, 2009
Messages
1,027
Office Version
  1. 365
Platform
  1. Windows
Hello All,

I would like code that highlights blank cells in the column named "Model", red - without using conditional formatting.

I need the search to continue on until it get to the bottommost row of data in the Column named "Customer Number"

Thanks much!
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Assuming that your data starts in row 1 try
Code:
Sub ColourRed()
Range("H:H").SpecialCells(xlBlanks).Interior.Color = vbRed
End Sub
Change the H:H to suit
 
Upvote 0
The code has to look for the two columns by their names, because the columns will constantly switch position.
I'm looking for the data to stop searching when it is equal to the last row of data in "Customer Number" column.

Thanks
 
Upvote 0
What row is your header in?
 
Upvote 0
How about
Code:
Sub ColourRed()
Dim fnd As Range
Set fnd = Range("1:1").Find("Model", , , xlWhole, , , False, , False)
If Not fnd Is Nothing Then fnd.EntireColumn.SpecialCells(xlBlanks).Interior.Color = vbRed
End Sub
 
Upvote 0
No, it needs to stop equivalent to the bottommost row of data in the "Customer Number" column.

Thanks
 
Upvote 0
In post 7 you said:
Customer Number
column

But your subject title for this posting says:

Re: Highlight blank cells in the column named
"Model​
"
 
Last edited:
Upvote 0
Yes, I want to highlight the cells in the "model" column red, but not all the way down to row 1millionsomething. I want it to stop at the bottommost row of data in the "customer number" column.

But, no worries. I actually got it. I added this small piece of code in addition to yours and it did the trick...

Code:
lastRow = ActiveSheet.UsedRange.Rows.Count

Thanks for helping out with your part of the code.
 
Upvote 0
Yes, I wanted to highlight the cells in the "model" column red, but not all the way down to row 1millionsomething. I want it to stop at the bottommost row of data in the "customer number" column.

But, no worries. I actually got it. I added this small piece of code in addition to yours and it did the trick...

Code:
lastRow = ActiveSheet.UsedRange.Rows.Count

Thanks for helping out with your part of the code.
 
Upvote 0

Forum statistics

Threads
1,213,504
Messages
6,114,016
Members
448,543
Latest member
MartinLarkin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top