Identifying a blank cell with existing value

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.
 
F

funkymonkUK

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top