+ Reply to Thread
Results 1 to 3 of 3

Detect Edit Mode

  1. #1
    Forum Contributor
    Join Date
    07-23-2016
    Location
    Texas
    MS-Off Ver
    2016
    Posts
    273

    Detect Edit Mode

    I have a macro that runs when a user clicks a button shape. If the user has entered data in a cell but has not hit return or selected another cell then clicks on the button to run the macro, the data in the cell used in the Macro is the old data instead of the new data entered. Is there any way to ensure that the cell is exited before the macro is run? My only solution so far is to check in the macro. I tried selecting a "home" cell in the macro when it starts with a "doevents" but still the old data in the cell is used. Anyone know how to resolve this and have the macro run the new data in the cell. According to what I can find on the internet, Excel has no way of detecting if a cell is under edit in VBA.

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,945

    Re: Detect Edit Mode

    Excel will not allow a macro to run when in Edit mode. Clicking the button in this example workbook takes Excel out of edit mode and completes the entry in the cell being edited. My simple test macro uses the new value that was being entered at the time of the button being clicked.

    If you could share a (much simplified) version of your workbook that displays the behavior you describe, then that would allow us to figure out what is going on.
    Attached Files Attached Files
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Forum Contributor
    Join Date
    07-23-2016
    Location
    Texas
    MS-Off Ver
    2016
    Posts
    273

    Re: Detect Edit Mode

    Thanks for feedback. The resetting a range to the active cell worked ok. Problem solved.

+ 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. Detect Break-Mode
    By onidarbe in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-31-2016, 01:43 PM
  2. [SOLVED] Open a form in Edit mode using VBA
    By jeskit in forum Access Programming / VBA / Macros
    Replies: 4
    Last Post: 04-19-2012, 10:03 AM
  3. VBA for edit mode
    By mikeburg in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-10-2008, 07:44 PM
  4. Detect if cell is in 'editing' mode
    By mkgan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-13-2007, 03:15 AM
  5. Replies: 5
    Last Post: 07-20-2006, 10:45 PM
  6. Cursor in edit mode
    By cinvic in forum Excel General
    Replies: 3
    Last Post: 02-12-2006, 11:50 AM
  7. Replies: 0
    Last Post: 01-07-2005, 04:06 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