VBA Look for blank cells in columns and highlight the header of the column
Results 1 to 4 of 4

Thread: VBA Look for blank cells in columns and highlight the header of the column
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    New Member
    Join Date
    May 2016
    Posts
    46
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

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

    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 by tropics123; Aug 16th, 2019 at 11:04 AM.

  2. #2
    MrExcel MVP
    Join Date
    May 2009
    Posts
    16,379
    Post Thanks / Like
    Mentioned
    36 Post(s)
    Tagged
    8 Thread(s)

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

    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
    Joe

    When I was a young man I knew everything. Now that I'm older, I realize I know very little, and what I do know, I tend to forget!

  3. #3
    New Member
    Join Date
    May 2016
    Posts
    46
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

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

    Thank you! This works perfectly!

  4. #4
    MrExcel MVP
    Join Date
    May 2009
    Posts
    16,379
    Post Thanks / Like
    Mentioned
    36 Post(s)
    Tagged
    8 Thread(s)

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

    Quote Originally Posted by tropics123 View Post
    Thank you! This works perfectly!
    You are welcome - thanks for the reply.
    Joe

    When I was a young man I knew everything. Now that I'm older, I realize I know very little, and what I do know, I tend to forget!

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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