Results 1 to 4 of 4

Macro to Hilight Blank Cells

This is a discussion on Macro to Hilight Blank Cells within the Excel Questions forums, part of the Question Forums category; Hi All, I need a macro to do the following. It starts in column D and I want to check ...

  1. #1
    Board Regular
    Join Date
    Jul 2009
    Posts
    166

    Talking Macro to Hilight Blank Cells

    Hi All,

    I need a macro to do the following.

    It starts in column D and I want to check the cell in column C; if column C contains data of any kind then highlight D yellow.

    It needs to keep going on a loop until it gets to the last cell in column C that contains data.

    Can anyone help?
    Thanks
    Jay3

    P.S. My last post was resolved so thanks to everyone who helped out. Can't actually find my post to let everyone know though.

  2. #2
    New Member Dosnox's Avatar
    Join Date
    Apr 2012
    Location
    London
    Posts
    45

    Default Re: Macro to Hilight Blank Cells

    Hi Jay

    How about using this code as Macro

    Code:
    Sub FillBlank()
    Dim myrange As Range
    Dim cell As Object
    Dim Lastrow As Long
    Lastrow = Range("C1048576").End(xlUp).Row
    Set myrange = Range("A1:A" & Lastrow)
    For Each cell In myrange
        If cell.Value <> "" Then
            cell.Offset(0, 1).Interior.ColorIndex = 6
         End If
    Next cell
    End Sub
    Depending on what excel you have change C1048576 in the macro to the very last cell.

    Hope it helps

  3. #3
    Board Regular
    Join Date
    Jul 2009
    Posts
    166

    Talking Re: Macro to Hilight Blank Cells

    Thanks, I'll try it out.

  4. #4
    Board Regular davesweep's Avatar
    Join Date
    Apr 2007
    Location
    Warrington, UK
    Posts
    283

    Default Re: Macro to Hilight Blank Cells

    Does this work for you?

    Code:
    Sub a()
    Dim rC As Range, rCell As Range
    
    Set rC = Range(Cells(1, 3), Cells(Rows.Count, 3).End(xlUp))
    
    For Each rCell In rC
    If rCell.Value <> "" Then rCell.Offset(0, 1).Interior.ColorIndex = 6
    Next rCell
    
    End Sub

Bookmarks

Posting Permissions

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


DMCA.com