Results 1 to 5 of 5

Backspace event text box string formatting not able to delete characters

Threaded View

Code Flunkie Backspace event text box... 05-28-2014, 01:40 PM
Norie Re: Backspace event text box... 05-28-2014, 02:13 PM
Code Flunkie Re: Backspace event text box... 05-28-2014, 03:16 PM
Norie Re: Backspace event text box... 05-28-2014, 03:22 PM
Code Flunkie Re: Backspace event text box... 05-28-2014, 04:30 PM
  1. #1
    Forum Contributor
    Join Date
    07-16-2009
    Location
    Montreal, Canada
    MS-Off Ver
    Excel 2013
    Posts
    114

    Backspace event text box string formatting not able to delete characters

    I'm trying to make a user form for data entry and I have a textbox with tariff codes. the layout is ####.##.##.## which the macro works well at formatting. problem is when you try to backspace you cannot go past any of the periods. I tried to trap a backspace event as a condition for not putting the period but it does not seem to work. also I tried to prevent the user from entering their own periods and that isn't working either.

    any help would be much appreciated.

    Thanks,

    Chris


    Private Sub FITextBox14_Change()
    
    Dim KeyAscii As Integer
    
    If KeyAscii = 46 Then
        KeyAscii = 0
    End If
    
    If Len(FITextBox14.Text) = 4 And KeyAscii <> vbKeyBack Then
        FITextBox14.Text = FITextBox14.Text & Chr(46)
    End If
    If Len(FITextBox14.Text) = 7 And KeyAscii <> vbKeyBack Then
        FITextBox14.Text = FITextBox14.Text & Chr(46)
    End If
    If Len(FITextBox14.Text) = 10 And KeyAscii <> vbKeyBack Then
        FITextBox14.Text = FITextBox14.Text & Chr(46)
    End If
    
    End Sub
    Last edited by Code Flunkie; 05-28-2014 at 04:30 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. delete last 5 characters from string
    By leooconnor in forum Excel General
    Replies: 6
    Last Post: 01-02-2015, 08:50 PM
  2. Replies: 4
    Last Post: 12-08-2010, 01:28 PM
  3. Register backspace within a combobox change event
    By Newbie_Nick in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-03-2010, 07:24 AM
  4. Assigning backspace and delete to form buttons
    By solnajeff in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-03-2010, 09:32 AM
  5. Macro to delete row based on criteria (first few characters of string)
    By delapp@hotmail.com in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-15-2006, 01:15 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