Identifying a blank cell with existing value

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I was writing a macro to replace all the blank cells in a worksheet. The
problem faced is there are some cells which are blank, but when I check in
the formula box, the value is some type of space(the way tab and whitespace
character display a space. when you enter a character after them, then only
you know that it has a space character before it.)
â€When I tried displaying the character from a message box in my programme,
the value displayed was as shown below.
?
Can anyone help me to understand what is happening. It certainly is not a
blank cell as when I try to check if its blank by using a statement like:

val = worksheet("A").cells(2,1).value
If val <> "" then
do this

then it successfully enters the loop which is not the case for complete
blank cells.
please help me out.
 
Have you tried something along the lines of "Empty" such as below

Sub test()
If ActiveCell.Value = Empty Then
MsgBox "hello world"
End If

End Sub
 
Back
Top