+ Reply to Thread
Results 1 to 4 of 4

Len(.Range("K5").Value) > 0 although there is no(!) value in Range("K5") !!

  1. #1
    Registered User
    Join Date
    11-25-2014
    Location
    Frankfurt, Germany
    MS-Off Ver
    2007
    Posts
    13

    Len(.Range("K5").Value) > 0 although there is no(!) value in Range("K5") !!

    There is NO value in Range("K5") but the following code does NOT produce the MsgBox:

    Sub test()
    With Worksheets("Table1")
    If Len(.Range("K5").Value) = 0 Then
    MsgBox "Cell is Empty"
    End If
    End With
    End Sub


    This is the weirdest thing I have ever had with VBA. Please help!!!

  2. #2
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: Len(.Range("K5").Value) > 0 although there is no(!) value in Range("K5") !!

    Maybe add Trim?

    Please Login or Register  to view this content.

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Len(.Range("K5").Value) > 0 although there is no(!) value in Range("K5") !!

    Are you sure there's no space, carriage return, other non-printing character in the cell?
    If posting code please use code tags, see here.

  4. #4
    Registered User
    Join Date
    11-25-2014
    Location
    Frankfurt, Germany
    MS-Off Ver
    2007
    Posts
    13

    Re: Len(.Range("K5").Value) > 0 although there is no(!) value in Range("K5") !!

    Thank you very much! That solved it!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] If Not ActiveSheet.Range("A1").Value Like "apple" Then MsgBox "Error"
    By HerryMarkowitz in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-18-2014, 02:16 PM
  2. Replies: 5
    Last Post: 01-23-2014, 11:02 AM
  3. if Range("A1") = "Mike" Then Range("A1") = "michael" Then Exit Sub
    By a8015945 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-30-2013, 10:08 AM
  4. [SOLVED] Sheets("Sheet2").Range("AA1") = "Note"
    By dcburkejr in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-03-2012, 04:10 PM
  5. use variable in Workbooks("book1").Worksheets("sheet1").Range("a1"
    By Luc in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-28-2005, 04:05 PM

Tags for this Thread

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