Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.
Hi all, please see this major site announcement: https://www.boards.ie/discussion/2058427594/boards-ie-2026

xcel-vba lose focus from cell

  • 19-07-2011 09:55PM
    #1
    Closed Accounts Posts: 613 ✭✭✭


    I have a vba macro that saves text entered by the user.The problem or more accurately inconvience is that the user has to click out of the cell before hitting the macro button.
    Would be better if they enter the text and then hit the button.
    At the moment the macro will not run unless they click to another cell or press enter.
    Is it possible to remove the focus as part of the macro?
    Thanks!


Comments

  • Registered Users, Registered Users 2 Posts: 7,468 ✭✭✭Evil Phil


    4Sheets wrote: »
    I have a vba macro that saves text entered by the user.The problem or more accurately inconvience is that the user has to click out of the cell before hitting the macro button.
    Would be better if they enter the text and then hit the button.
    At the moment the macro will not run unless they click to another cell or press enter.
    Is it possible to remove the focus as part of the macro?
    Thanks!

    It should be, you should be able to set the focus to cell A1 or where ever you want. So is it a case the the macro will start but not complete unless the focus is moved to another cell?


  • Closed Accounts Posts: 613 ✭✭✭4Sheets


    Evil Phil wrote: »
    It should be, you should be able to set the focus to cell A1 or where ever you want. So is it a case the the macro will start but not complete unless the focus is moved to another cell?
    Thanks for the reply..
    The cell is selected and the text is entered..so the cursor is still in the box..I have the button on a toolbar but the macro will not start so statements in the macro to select cells etc will not have any effect..The computer also gives a little error beep when clicking the button..
    Am thinking this is just the way excel is ..


  • Registered Users, Registered Users 2 Posts: 7,468 ✭✭✭Evil Phil


    I could be the default behaviour alright, in fact I'm going to say it is. Normally you have to move away from a cell in Excel for it to be *complete*. I'm used to using it that way anyway, for instance I pretty much always hit Enter when I've finished entering cell data. Maybe this problem isn't so bad after all ....


Advertisement
Advertisement