Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: If not (in this collection of numbers or asci characters) th

  1. #1
    Board Regular
    Join Date
    Mar 2002
    Posts
    162
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi,

    I`m using this piece of programme

    *******
    Private Sub TBL1_Change()
    Worksheets("sheet1").Range("B2").Value = TBL1
    If Not IsNumeric(TBL1.Value) Then
    MsgBox "Alleen numerieke data is toegestaan", vbExclamation, "Invalid Entry"
    End If
    End Sub
    ******

    to put data from a textbox to a cell. As you can see I do not want this data to be alphanumeric. however, I want to narrow the numeric options down also: only 0-4 may be used. Also: backspace must not generate the message. Now I`ve heard the best way to approach this is via the asci keycode constants.

    Can anyone pass me some syntax to perform this:

    "If the value of TBL1 input window is anything other that 1-4 or backspace, then"

    Thanks a loooooottt.
    Dinictus


  2. #2
    Board Regular
    Join Date
    Mar 2002
    Location
    Cincinnati, Ohio, USA
    Posts
    6,824
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Private Sub TBL1_Change()
    'Won't need the commented code
    'If Not IsNumeric(TBL1.Value) Then
    ' MsgBox "Alleen numerieke data is toegestaan", vbExclamation, "Invalid Entry"
    'End If

    Select Case TBL1.Value
    Case 0, 1, 2, 3, 4
    Worksheets("sheet1").Range("B2").Value = TBL1
    Case Else
    MsgBox "Alleen numerieke data is toegestaan", vbExclamation, "Invalid Entry"
    End Select
    End Sub

    [ This Message was edited by: TsTom on 2002-03-21 06:10 ]

  3. #3
    Board Regular
    Join Date
    Mar 2002
    Posts
    162
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Thanks a LOAD

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •