+ Reply to Thread
Results 1 to 5 of 5

Stop text box from auto refreshing in VBA

  1. #1
    Registered User
    Join Date
    07-15-2014
    Location
    Birmingham
    MS-Off Ver
    2013
    Posts
    18

    Stop text box from auto refreshing in VBA

    I'm currently encountering a problem. I have set up an if statement on a text box - if the number is smaller than 2.4, and larger than 6 then return an error.

    However, if a user wishes to input 2.8, it will throw the error when 2 is entered, and when the '.' is entered.

    Here is my code:

    Please Login or Register  to view this content.

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Stop text box from auto refreshing in VBA

    Put your code in the LostFocus event, rather than the Change event.
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  3. #3
    Registered User
    Join Date
    07-15-2014
    Location
    Birmingham
    MS-Off Ver
    2013
    Posts
    18

    Re: Stop text box from auto refreshing in VBA

    Thanks Olly, but now it isn't updating at all in my "Total" text box

  4. #4
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Stop text box from auto refreshing in VBA

    It will when the txtHeight text box loses focus... Tab / click to next control.

  5. #5
    Registered User
    Join Date
    07-15-2014
    Location
    Birmingham
    MS-Off Ver
    2013
    Posts
    18

    Re: Stop text box from auto refreshing in VBA

    I have changed it to AutoRefresh instead of Change. It now works - thanks.

+ 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. To Stop Refreshing the data
    By icemantj in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-12-2010, 05:43 AM
  2. Excel 2007 : Stop pivot tables auto-refreshing on open
    By Andy Warner in forum Excel General
    Replies: 0
    Last Post: 03-12-2009, 04:59 AM
  3. Why would Excel stop auto text for one word only
    By princess in forum Excel General
    Replies: 1
    Last Post: 03-10-2006, 05:00 PM
  4. Replies: 3
    Last Post: 10-16-2005, 05:58 AM
  5. [SOLVED] How do I stop auto converting Text(Inventory#) to Dates
    By DavidB in forum Excel General
    Replies: 1
    Last Post: 09-02-2005, 01:05 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