+ Reply to Thread
Results 1 to 4 of 4

VBA if active cell blank than msgbox to remind

  1. #1
    Forum Contributor
    Join Date
    08-20-2013
    Location
    LX
    MS-Off Ver
    Office 2019
    Posts
    164

    VBA if active cell blank than msgbox to remind

    Hello,

    I want a vba that when I hit the *Tab or Enter* key, and nothing (text, date, number) is in the active cell, that a msgbox appear to remind me that I have to fill out the cell. In the msgbox I need to have the choice, If I wish to continue anyway without filling so it will automaticcly jump to next cell in the row (not colomun) or go back to the active cell and do some input.

    Help very appreciate.

    Thanks

  2. #2
    Valued Forum Contributor Naveed Raza's Avatar
    Join Date
    11-04-2012
    Location
    India, Hyderabad
    MS-Off Ver
    Excel, Access 2007/2010
    Posts
    1,338

    Re: VBA if active cell blank than msgbox to remind

    are looking something like this
    Attached Files Attached Files
    Thanks - Naveed
    -----------------------------
    If the suggestion helps you, then Click * to Add Reputation
    To Attach File: Go Advanced>>Manage Attachments>>Add Files (In Top Right Corner)>>SelectFiles>>.........Locate Your File(s)>>Upload Files>>Done (In Bottom Right)
    1. Use [code] code tags [\code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    2. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

  3. #3
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2411
    Posts
    26,715

    Re: VBA if active cell blank than msgbox to remind

    Are you trying to notify the user that the previous active cell is blank? Because hitting Tab or Enter will change which cell is the active cell. There is nothing built into VBA to tell you what cell was active before they hit Tab or Enter. You would have to build code that keeps track of which cell was active every time the user changes cells. Certainly feasible, but I would want to have your actual file to provide any further detail.

    If I am guessing your intent correctly, then you have two other options that I can think of:

    1. When the user thinks they are finished entering all data, they press a Submit button and at that point you scan for blank cells, rather than catching it at the moment it happens. This has the advantage of giving the user a little slack if they go to a cell, then decide to leave it blank so they can come back to it later after entering other data.
    2. Use a UserForm instead, which has events that can detect if the user leaves a field
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

  4. #4
    Forum Contributor
    Join Date
    09-05-2012
    Location
    Dubai
    MS-Off Ver
    Office 365
    Posts
    409

    Re: VBA if active cell blank than msgbox to remind

    Try
    Put this code to the Worksheet_SelectionChange event. Make sure macro needs to be put in the Sheet object module, not the regular modules in VBA.
    Please Login or Register  to view this content.

+ 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] Insert a Blank Row at every other row where active cell <> X or <> Y etc
    By stimpsond1 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 03-22-2013, 05:17 AM
  2. MsgBox if the Active Cell is not within a preferred Range
    By Winon in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-03-2011, 05:52 AM
  3. Formula only active if cell blank
    By doowop5000 in forum Excel General
    Replies: 2
    Last Post: 07-14-2007, 01:44 AM
  4. can a cell remind you of an upcoming bill date payment
    By Colin2u in forum Excel General
    Replies: 3
    Last Post: 08-11-2005, 03:05 PM

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