+ Reply to Thread
Results 1 to 9 of 9

Setting up if cell is blank don't continue... and show a message.

  1. #1
    Forum Contributor
    Join Date
    11-11-2007
    Posts
    263

    Setting up if cell is blank don't continue... and show a message.

    This code works perfectly. I only have one question, I want to make it so that if there is nothing in cell Q23 that it will not put anything into NCMR Data, and say something... the code is below of what I have, and below it is what I think I need to do to a specific section to work, can someone review and make sure I am on the right path?



    Please Login or Register  to view this content.

    What I want to do I think:
    Please Login or Register  to view this content.

  2. #2
    Valued Forum Contributor StevenM's Avatar
    Join Date
    03-23-2008
    Location
    New Lenox, IL USA
    MS-Off Ver
    2007
    Posts
    910

    Re: Setting up if cell is blank don't continue... and show a message.

    Instead of:

    Please Login or Register  to view this content.
    I think what you want is:

    Please Login or Register  to view this content.
    Asking if "f Is Nothing" (or "Not f Is Nothing") only determines whether or not the range ('f') has been "set."

  3. #3
    Forum Contributor
    Join Date
    11-11-2007
    Posts
    263

    Re: Setting up if cell is blank don't continue... and show a message.

    No go, Says Method or Data not found... and it highlights the row I just changed.

  4. #4
    Valued Forum Contributor StevenM's Avatar
    Join Date
    03-23-2008
    Location
    New Lenox, IL USA
    MS-Off Ver
    2007
    Posts
    910

    Re: Setting up if cell is blank don't continue... and show a message.

    How about:

    Please Login or Register  to view this content.
    P.S. Before "Cell" should have been "Cells" (my mistake), but even so, Cells cannot take a "Q23" type reference whereas Range can.

  5. #5
    Forum Contributor
    Join Date
    11-11-2007
    Posts
    263

    Re: Setting up if cell is blank don't continue... and show a message.

    Nope, still allow entering of data with nothing in it. Here is the script as of now.

    Please Login or Register  to view this content.

  6. #6
    Valued Forum Contributor StevenM's Avatar
    Join Date
    03-23-2008
    Location
    New Lenox, IL USA
    MS-Off Ver
    2007
    Posts
    910

    Re: Setting up if cell is blank don't continue... and show a message.

    Are you sure that wsInt.Range("Q23") is empty? Could there be an empty space character left over inside the cell which might not show? Or is there a formula inside that cell?

    You might try something like:

    Please Login or Register  to view this content.
    Trim should takeout any spaces (it takes out leading and trailing spaces from a string).

  7. #7
    Forum Contributor
    Join Date
    11-11-2007
    Posts
    263

    Re: Setting up if cell is blank don't continue... and show a message.

    Quote Originally Posted by StevenM View Post
    Are you sure that wsInt.Range("Q23") is empty? Could there be an empty space character left over inside the cell which might not show? Or is there a formula inside that cell?

    You might try something like:

    Please Login or Register  to view this content.
    Trim should takeout any spaces (it takes out leading and trailing spaces from a string).
    I am positive, here is the page in question. Without the code. Just to show you what I am attempting to do.
    Attached Files Attached Files

  8. #8
    Valued Forum Contributor StevenM's Avatar
    Join Date
    03-23-2008
    Location
    New Lenox, IL USA
    MS-Off Ver
    2007
    Posts
    910

    Re: Setting up if cell is blank don't continue... and show a message.

    I ran the following test a number of times on your worksheet.

    Please Login or Register  to view this content.
    And when I put a value in Q23 ("Sales Order"), and ran the above macro, it tested as not empty.
    Then when I deleted a value in Q23, it tested as empty.

    I then copied and pasted your code, and it ran as expected. When there was nothing in Q23, the message popped up, and when there was something in Q23 it bypassed the message.

    I'm at a loss to understand your problem.

  9. #9
    Forum Contributor
    Join Date
    11-11-2007
    Posts
    263

    Re: Setting up if cell is blank don't continue... and show a message.

    Quote Originally Posted by StevenM View Post
    I ran the following test a number of times on your worksheet.

    Please Login or Register  to view this content.
    And when I put a value in Q23 ("Sales Order"), and ran the above macro, it tested as not empty.
    Then when I deleted a value in Q23, it tested as empty.

    I then copied and pasted your code, and it ran as expected. When there was nothing in Q23, the message popped up, and when there was something in Q23 it bypassed the message.

    I'm at a loss to understand your problem.
    Because if you look at the code you originally suggested and what you have down here it is different format wise. There is no Exit Sub, or other parts in it like your original post. I'll try out the code you just posted and get back to you on it.

+ 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