![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Mar 2002
Posts: 162
|
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 |
|
Board Regular
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
|
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 |
|
Board Regular
Join Date: Mar 2002
Posts: 162
|
Thanks a LOAD
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|