Test for empty cell

  • Code
    If activecell.Value > "" And activecell.Offset(0, 2).Value = "" Then
    activecell.Offset(0, 3).Value = ("Check this line")
    With activecell.Offset(0, 3).Font
      .Name = "Verdana"
            .Size = 8
            .ColorIndex = 5
            .Bold = True

    I am trying to find a less volatile way of testing for missing data. This works perfectly if I delete cell contents in active cell before running this code but dosent work if that cell contained any data that was not deleted such as removed with a space bar.

    Thanks for any help!!

  • Re: Test for empty cell

    The problem is that, when you erase data with space bar, the value is not "" but is " " includes spaces. so good way is to trim the spaces and try again.

    It worked for me... let me know if it works for you.

    Thanks: ~Yogendra

  • Re: Test for empty cell

    Thanks for the help Yjoshi...it cleared it right up!! Hope yourself and family are OK with the quake / tsunamis disaster. Sounds horrific.

  • Re: Test for empty cell

    If i remember correctly, I've occasionally had trouble using ="" to test for blank cells on files that have been imported. They sometimes come in with a hidden text-forcing entry that does not display and shows zero cell length. So, as an alternative (if you ever encounter problems, you might also try:

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!