ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   validating input in textbox (https://www.excelbanter.com/excel-programming/337257-validating-input-textbox.html)

Jean-Pierre D via OfficeKB.com

validating input in textbox
 
Hi,

My spreadsheet consists of a numer of sheets:
1. input data from the user
2. a sheet where i make my calculations based on the input of the user
3. help file in which additional dat is stored, needed for the calculations

I would like to construct an application where you don't see excel anymore.
I don't know if this is possible but i started anyway to see if it can be
done.

I have a few questions:

I made the application so that excel disappers (and appears again on closing)
The only thing you see is the multipage userform i constructed (4 pages)
most pages are used to get a sort of flow of information (step 1-4) and on
one page i put an excel sheet where the user can input a database of persons
which i need for the calculations.

Q1. Do i still need excell to make the difficult calculations ore can i let
vba do the calculation for each databasemember and get the total on a
differen page of the userform ? after vba calculated each single memeber of
the database, i want the total...

Q2. How can i access the data in the spreadsheet on the page in the
multipageform ?

Q3 I have a multipage userform on which the user can input various items in
combo's text boxes etc.
in one particular instance I want the input in a textbox to always be an
number (numeric value) and i wrote the following code:

Private Sub hui_eb_hoofd_change()
OnlyNumbers
End Sub

Private Sub OnlyNumbers()
With Me.ActiveControl
If Not IsNumeric(.Value) And .Value < vbNullString Then
MsgBox "Sorry, alleen getallen toegestaan"
.Value = vbNullString
End If
End With
End Sub

Nothing happens when i enter text instead of numbers. Did i construct the
code wrong or did i place it in the wrong part of the project (i put in in
the form's VBA)? i don't know...anybody?

By the way, i'am looking also for a way to make sure thereis a dat entered
(dd:mm:yyyy) and a way to make sure a percentage is put in with 2 decimals....


I know, a lot of questions but i' am still a novice...but learning fast...
hopefully.
thanks for your help guys !
Jean-Pierre


--
Message posted via http://www.officekb.com

Harald Staff

validating input in textbox
 
Hi Jean Pierre

Q3 only: Use this code for your textbox and only positive integers can be
typed into it:

Private Sub TextBox1_KeyDown(ByVal KeyCode As _
MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 86 Then KeyCode = 0
End Sub

Private Sub TextBox1_KeyPress(ByVal KeyAscii As _
MSForms.ReturnInteger)
Select Case KeyAscii
Case 48 To 57
Case Else
KeyAscii = 0
End Select
End Sub

HTH. Best wishes Harald


"Jean-Pierre D via OfficeKB.com" skrev i melding
...
Hi,

My spreadsheet consists of a numer of sheets:
1. input data from the user
2. a sheet where i make my calculations based on the input of the user
3. help file in which additional dat is stored, needed for the

calculations

I would like to construct an application where you don't see excel

anymore.
I don't know if this is possible but i started anyway to see if it can be
done.

I have a few questions:

I made the application so that excel disappers (and appears again on

closing)
The only thing you see is the multipage userform i constructed (4 pages)
most pages are used to get a sort of flow of information (step 1-4) and on
one page i put an excel sheet where the user can input a database of

persons
which i need for the calculations.

Q1. Do i still need excell to make the difficult calculations ore can i

let
vba do the calculation for each databasemember and get the total on a
differen page of the userform ? after vba calculated each single memeber

of
the database, i want the total...

Q2. How can i access the data in the spreadsheet on the page in the
multipageform ?

Q3 I have a multipage userform on which the user can input various items

in
combo's text boxes etc.
in one particular instance I want the input in a textbox to always be an
number (numeric value) and i wrote the following code:

Private Sub hui_eb_hoofd_change()
OnlyNumbers
End Sub

Private Sub OnlyNumbers()
With Me.ActiveControl
If Not IsNumeric(.Value) And .Value < vbNullString Then
MsgBox "Sorry, alleen getallen toegestaan"
.Value = vbNullString
End If
End With
End Sub

Nothing happens when i enter text instead of numbers. Did i construct the
code wrong or did i place it in the wrong part of the project (i put in in
the form's VBA)? i don't know...anybody?

By the way, i'am looking also for a way to make sure thereis a dat entered
(dd:mm:yyyy) and a way to make sure a percentage is put in with 2

decimals....


I know, a lot of questions but i' am still a novice...but learning fast...
hopefully.
thanks for your help guys !
Jean-Pierre


--
Message posted via http://www.officekb.com





All times are GMT +1. The time now is 04:39 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com