+ Reply to Thread
Results 1 to 3 of 3

Identifying a blank cell with existing value

  1. #1
    Monty
    Guest

    Identifying a blank cell with existing value

    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.

  2. #2
    Muhammed Rafeek M
    Guest

    RE: Identifying a blank cell with existing value

    use trim function
    like:
    If trim(val) <> "" then
    do this

    "Monty" wrote:

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


  3. #3
    Forum Contributor funkymonkUK's Avatar
    Join Date
    01-07-2005
    Location
    London, England
    Posts
    500
    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

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1