+ Reply to Thread
Results 1 to 4 of 4

Userform, transfer characters to cells by typing

  1. #1
    Forum Contributor
    Join Date
    11-10-2009
    Location
    Perth, Australia
    MS-Off Ver
    Excel 2007
    Posts
    549

    Userform, transfer characters to cells by typing

    The code below allows you to edit the contents of a cell by typing ... and preserves the fonts every time a character is typed.
    This works as intended.

    Because there is a relatively large amount of code processed, every time a key is pressed, if you press several keys in quick succession, it throws the fonts out.
    Try pressing a single key and wait until pressing the next, this is fine. Try pressing two or more keys in less than a second, the fonts are lost.

    Is there a way to optimise the code so the issue is reduced.


    ClassTyping
    Please Login or Register  to view this content.


    Userform code
    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    11-10-2009
    Location
    Perth, Australia
    MS-Off Ver
    Excel 2007
    Posts
    549

    Re: Userform, transfer characters to cells by typing

    Maybe it's not an issue with speed of typing?
    If you press the same character in quick succession, there is no issue.
    If you press different characters in quick succession, there is an issue ... also if you press and hold a key giving several of the same character.

  3. #3
    Forum Contributor
    Join Date
    11-10-2009
    Location
    Perth, Australia
    MS-Off Ver
    Excel 2007
    Posts
    549

    Re: Userform, transfer characters to cells by typing

    I've tried counters and boolean expressions but these are not processed in logical order if the keystrokes are fast (for example, 2 KeyDown events recorded followed by 2 KeyUp events).

    The Timer function may work, it shows the time in seconds, since the previous day. The accuracy seems to be to 1/100 seconds as observed with Debug.Print.
    What I have below is a progression but has a peculiarity to it.
    The characters are supposed to be entered only if the time difference between keystrokes is within 0.5 seconds.
    Try pressing many keys in quick succession, nothing happens, then wait at least 0.5 seconds, press one more key ... and all the characters which did not appear before suddenly appear.

    Is there anyway to fix this?


    ClassTyping
    Please Login or Register  to view this content.
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    11-10-2009
    Location
    Perth, Australia
    MS-Off Ver
    Excel 2007
    Posts
    549

    Re: Userform, transfer characters to cells by typing

    This seems to work if anyone's interested.
    It uses "vbNull" if typing speed is higher than the allowed, 0.5 seconds in this case.

    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. Replies: 5
    Last Post: 06-02-2016, 05:55 PM
  2. Replies: 1
    Last Post: 04-27-2016, 12:40 AM
  3. Userform does not transfer data after I align cells
    By Lesliejr in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-17-2015, 05:50 PM
  4. [SOLVED] displaying number of characters entered into a cell while typing
    By Alex Zbinden in forum Excel - New Users/Basics
    Replies: 10
    Last Post: 01-13-2015, 05:22 PM
  5. How to count the number of characters while typing
    By Tam123 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-08-2013, 10:50 AM
  6. Restricting typing of special characters
    By flakedew in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-20-2012, 11:26 AM
  7. Replies: 1
    Last Post: 04-16-2006, 10:00 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