VBA Look for blank cells in columns and highlight the header of the column

tropics123

Board Regular
Joined
May 11, 2016
Messages
85
Hi, thank you in advance for you help! Here's what the VBA is trying to do but not successful :) Look for blank cells in columns D and J, if there are blank cells then highlight the header cell in the same column and if no blank then do nothing. This will let me know there are blank cells to look at rather than filter every time since the data will change daily. Thank you so much for your help!

Sub Blank()


If IsEmpty(Range("D").Value) Then


Range("D1").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 49407
.TintAndShade = 0
.PatternTintAndShade = 0

Next


If IsEmpty(Range("J").Value) Then
Range("J1").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 49407
.TintAndShade = 0
.PatternTintAndShade = 0

End If


End Sub
 
Last edited:

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Maybe something like this:
Code:
Sub tropics123()
Dim usedR As Range
Set usedR = ActiveSheet.UsedRange
Application.ScreenUpdating = False
Range("D:D")(1).Interior.Color = xlNone
Range("J:J")(1).Interior.Color = xlNone
With Intersect(usedR, Columns("D"))
    If Application.CountA(.Cells) < .Rows.Count Then Columns("D").Cells(1, 1).Interior.Color = vbRed
End With
'repeat With-End With block for col J here
Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,523
Messages
6,120,042
Members
448,940
Latest member
mdusw

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