+ Reply to Thread
Results 1 to 9 of 9

How to check if cell is blank, but not empty

  1. #1
    Registered User
    Join Date
    05-28-2014
    Posts
    67

    How to check if cell is blank, but not empty

    How can I write code to test if a cell is blank? My code is using "isempty" but I keep type mismatch error because my cells are filled with formulas that make the cells blank. It only works if the cells are truly empty with no formulas.

    Thanks!

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,936

    Re: How to check if cell is blank, but not empty

    Try
    If Range("A1").Value = "" Then
    Ben Van Johnson

  3. #3
    Registered User
    Join Date
    05-28-2014
    Posts
    67

    Re: How to check if cell is blank, but not empty

    Thanks! Do you know how that would work in a For Each loop?

  4. #4
    Forum Contributor pareshj's Avatar
    Join Date
    05-20-2014
    Location
    MUMBAI
    MS-Off Ver
    2007 & 2010
    Posts
    447

    Re: How to check if cell is blank, but not empty

    Hi,


    For Each c In Worksheets("Sheet1").Range("A1:D10").Cells
    If c.Value = "" Then
    '' Do something
    End If
    Next

    Where A1:D10 is the sample range i have taken as an example. Please change it accordingly.



    Regards,
    Paresh J
    Click on "* Add Reputation" as a way to say thanks

  5. #5
    Registered User
    Join Date
    05-28-2014
    Posts
    67

    Re: How to check if cell is blank, but not empty

    Thank you so much!!

  6. #6
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,692

    Re: How to check if cell is blank, but not empty

    Like this?
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    05-28-2014
    Posts
    67

    Re: How to check if cell is blank, but not empty

    That seems like it'll work as well! Thank you!

  8. #8
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: How to check if cell is blank, but not empty

    NON vba soluition

    with an helpcolumn

    d1
    Please Login or Register  to view this content.
    if empty it returns zero (0)
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  9. #9
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: How to check if cell is blank, but not empty

    Quote Originally Posted by pareshj View Post
    Hi,


    For Each c In Worksheets("Sheet1").Range("A1:D10").Cells
    If c.Value = "" Then
    '' Do something
    End If
    Next

    Where A1:D10 is the sample range i have taken as an example. Please change it accordingly.



    Regards,
    Paresh J


    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

+ 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] How to check for an empty cell
    By Turtleman10 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 10-26-2012, 08:32 AM
  2. color blank cell red if blank or empty and count its occurances
    By stoey in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-01-2009, 08:21 AM
  3. Macro to check for blank cell entry, copy previous value, and check for duplicates
    By xPunxNotDeadx in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-26-2009, 06:33 PM
  4. check a cell is empty or not
    By associates in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-20-2006, 05:43 PM
  5. VB - Empty Cell Check
    By Fraggs in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-04-2005, 11:26 AM

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