LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default Require user to enter numeric value in TextBox

I have searched the forum for an answer to this problem, but have been
unable to find one that works for me.

I have UserForm4 with many textboxes. The problem concerns TextBox6. I
want the user to put a numeric value in TextBox6, and it cannot be
left blank.

I put this in to make sure the value is numeric only. It works fine.

Private Sub TextBox6_KeyPress(ByVal KeyAscii As
MSForms.ReturnInteger)
If KeyAscii < Asc("0") Or KeyAscii Asc("9") Then
KeyAscii = 0
End If
End Sub


For the other part of the problem, I tried putting this in
CommandButton1 code that will input all the TextBox data.
I added this in to make sure the user did not leave TextBox6 blank.

Private Sub CommandButton1_Click()
'OK Add this record

If TextBox6.Value = "" Then
MsgBox "There is NO Value in Textbox 6 "
TextBox6.SetFocus
Else
AddsRecord 'Sub below

End If


This works so far as to give me the message. But, it blanks out all
the textboxes the user filled out before hitting the OK button as if
it were starting over.
What I want is for all the data already entered in to be left alone,
and the focus set on TextBox6 to enter in a value. The user would do
this, then hit the OK button again, and all the data will be copied to
the sheet. I知 sure I知 almost there. Can anyone help??
Thanks
j.o.
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Here's how to require user to pass a particular param type to a cellfunction (intercepting #VALUE). [email protected] Excel Programming 6 February 21st 09 03:02 PM
If < equal to named list require user to fill out desired columns? Matt Pierringer Excel Programming 2 March 7th 07 10:04 PM
How do i require a user to enter a data in a field in Excel Fred Excel Programming 1 January 25th 06 06:26 PM
Require alpha-numeric entry Dana Excel Worksheet Functions 3 September 7th 05 07:53 AM
HELP! I Lost The Ability To Advance From TextBox To TextBox With the ENTER Or The TAB Keys Minitman[_4_] Excel Programming 0 February 22nd 05 08:50 PM


All times are GMT +1. The time now is 03:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ゥ2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"