Consulting

Results 1 to 3 of 3

Thread: Empty Cell Highlight

  1. #1

    Empty Cell Highlight

    I need to check a spreadsheet and highlight any cell that is empty in Col F. The Col will have either M or F or nothing in the cells. Can anyone help? This will go into an already working code on the same sheet.

    Alan

  2. #2
    VBAX Regular
    Joined
    Oct 2006
    Location
    Warsaw, Poland
    Posts
    23
    Location
    Hi,

    Quote Originally Posted by drums4monty
    I need to check a spreadsheet and highlight any cell that is empty in Col F. The Col will have either M or F or nothing in the cells. Can anyone help? This will go into an already working code on the same sheet.
    Try, for example, something like this (this code highlights cells by changing interior to yellow):

    Sub HighligthCells()
    Dim Xc As Range
    For Each Xc In Range("f1", Range("f65535").End(xlUp))
     If Xc.Value = "" Then Xc.Interior.ColorIndex = 6
    Next
     
    Range(Range("f65535").End(xlUp).Offset(1,0),"f65535").Interior.ColorIndex = 6
    End Sub
    One Hundred MS Excel Games

  3. #3
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Sub HiLiteBlanks()
        Dim rng As Range
        Set rng = Range("F1").Resize(Cells(Rows.Count, "F").End(xlUp).Row)
        rng.Select
        With Selection
            .FormatConditions.Delete
            .FormatConditions.Add Type:=xlExpression, Formula1:="=" & rng.Cells(1, 1).Address(0, 0) & "="""""
            .FormatConditions(1).Interior.ColorIndex = 3
        End With
        MsgBox "Number of blanks = " & Application.CountIf(rng, "")
    End Sub
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Tags for this Thread

Posting Permissions

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