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

Dinictus

Board Regular
Joined
Mar 19, 2002
Messages
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
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
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
 
Upvote 0

Forum statistics

Threads
1,214,396
Messages
6,119,268
Members
448,881
Latest member
Faxgirl

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top