Make every blank cell highlighted red

UncleBajubjubs

Board Regular
Joined
Jul 11, 2017
Messages
111
Office Version
  1. 2010
Hello, I'm looking for a VBA macro that will make every unfilled cell be highlighted red. I think this shouldn't be too complex, but I was having some issues proceeding. Thanks.
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Try this out..... just change your range to whatever range you want to cover

Code:
Sub Macro1()
Dim r As Range
For Each r In Range("A1:B10") 'change this to accommodate your range
    If r.Value = "" Then
        r.Interior.Color = 255
    End If
Next
End Sub
 
Upvote 0
How about
Code:
Sub FillRed()
On Error Resume Next
Cells.SpecialCells(xlBlanks).Interior.Color = vbRed
On Error GoTo 0
End Sub
 
Upvote 0
Why do you want VBA? You could use conditional formatting with a rule like: =ISBLANK(A1) and apply it to a1:z999 (or whatever your full sheet is).
 
Upvote 0
Why do you want VBA? You could use conditional formatting with a rule like: =ISBLANK(A1) and apply it to a1:z999 (or whatever your full sheet is).

I was going to make that suggestion but OP requested VBA so went with VBA ... CF would be less of a hassle
 
Upvote 0
Thanks, I was able to get it to work. I asked for VBA thinking it'd be easiest, CF didn't occur to me when i was working on it.
 
Upvote 0
Glad we could help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,248
Members
452,623
Latest member
cliftonhandyman

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