+ Reply to Thread
Results 1 to 2 of 2

RUN CODE ONE TIME _Click event

  1. #1
    Forum Contributor
    Join Date
    07-14-2019
    Location
    Dubai
    MS-Off Ver
    2019
    Posts
    919

    RUN CODE ONE TIME _Click event

    Hello

    How can I run my macro one time only if I select the textbox?
    mean if I click on textbox, code run 1 time only, and it back to work again only if I leave the textbox and enter it again
    What code sould I use in Private Sub TextBox1_Change() ?
    macro name : macro1

    Thanks

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: RUN CODE ONE TIME _Click event

    One way would be to set a 'flag' in an Excel cell and test for the flag in the macro.

    So Enter say the word "First" in a cell named say 'CheckFirst"

    Then in the macro use something like
    Please Login or Register  to view this content.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

+ 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. Need to add if error code to worksheet change event to stop a run-time error
    By KT99 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-18-2014, 03:10 PM
  2. Run Time error due to event change code when I delete columns in file
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-16-2012, 12:53 PM
  3. UserForm _Click() vs _Change()
    By foxguy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-25-2010, 02:45 AM
  4. Command Button not executing _Click() event
    By foxguy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-13-2010, 04:11 PM
  5. [SOLVED] Find the name of the label within its _Click() ?
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-11-2006, 11:15 AM
  6. Find the name of the label within its _Click() ?
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-09-2006, 09:04 PM
  7. command button()_click
    By iamkeen in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-03-2005, 12: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