+ Reply to Thread
Results 1 to 6 of 6

Not isempty()

Hybrid View

  1. #1
    Registered User
    Join Date
    09-28-2012
    Location
    boston
    MS-Off Ver
    Excel 2010
    Posts
    42

    Not isempty()

    So I want to check if IsEmpty is truly empty within the loop. I tried the below but get a compile error. What did I do wrong?


    Formula: copy to clipboard
    Do While Not IsEmpty(Cells(i, 1))

    If Not IsEmpty(Cells(i, 1) Then

    'DO STUFF

    End If


    Loop

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Not isempty()

    Hi, nikko50,

    maybe you donīt tell us that an error (which one?) occurred but what you want to do.

    Searching for empty cells within Column Ae?
    Sub Sample()
    On Error Resume Next
    Range("A1:A" & Cells(Rows.Count, "A").End(xlUp).Row).SpecialCells(xlCellTypeBlanks).Value = "Test"
    End Sub
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Registered User
    Join Date
    09-28-2012
    Location
    boston
    MS-Off Ver
    Excel 2010
    Posts
    42

    Re: Not isempty()

    Get syntax error at line "If Not IsEmpty(Cells(i, 1) Then"


    Basically I have code within the Do Loop that I want to not execute if the loop has reached it's final loop. How can I do this?

  4. #4
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Not isempty()

    Hi, nikko50,

    For lngCounter = 2 To Cells(Rows.Count, "A").End(xlUp).Row
    For Each rngCell in Range("A1:A" & Cells(Rows.Count, "A").End(xlUp).Row).SpecialCells(xlCellTypeConstants, 23)
    Ciao,
    Holger

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Not isempty()

    Entia non sunt multiplicanda sine necessitate

  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Not isempty()

    Hello nikko50,

    Forum Rule #8:
    Don't cross-post without a link. Cross-posting is when you post the same question in other forums on the web. You'll find people are disinclined to respond to cross-posts because they may be wasting their time solving a problem that has been solved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post. Expect cross-posts without a link to be closed.

    Thank Shg for posting the link for you. Please remember do so in future post.

    The syntax error is caused from not closing the statement properly.

    Code Is...
        If Not IsEmpty(Cells(i, 1) Then
    Code should be...
        If Not IsEmpty(Cells(i, 1)) Then
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

+ 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