Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
JPA JPA is offline
external usenet poster
 
Posts: 5
Default Validating Data in User Forms


I have a fairly simple issue but am not quite sure what the solution is:

Have created a basic form in Excel with several combo boxes.
The combo drop down values are "Y" or "N".

I have a command button that adds the values to a worksheet and clears the
combo boxes.

How do I prevent users from adding blank values to the worksheet? Ideally,
I would like to create an error routine/procedure which informs the user that
no blank values are allowed and highlights (or moves the cursor to) the field
with the blank value.

Thanks.

JPA.
  #2   Report Post  
Posted to microsoft.public.excel.programming
JPA JPA is offline
external usenet poster
 
Posts: 5
Default Validating Data in User Forms

Just a clarification from me - the poster of this thread.

I would like the error procedure to run from the form. Blank entries should
not be allowed on the form

The worksheet being written to is hidden and should stay that way (users
should not see it).


"JPA" wrote:


I have a fairly simple issue but am not quite sure what the solution is:

Have created a basic form in Excel with several combo boxes.
The combo drop down values are "Y" or "N".

I have a command button that adds the values to a worksheet and clears the
combo boxes.

How do I prevent users from adding blank values to the worksheet? Ideally,
I would like to create an error routine/procedure which informs the user that
no blank values are allowed and highlights (or moves the cursor to) the field
with the blank value.

Thanks.

JPA.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 146
Default Validating Data in User Forms

I hope this helps but what I would do is this

say you have two textboxes you wish to contain data before proceeding

Private Sub CommandButton1_Click()

dim hasError as boolean
hasError = false
if textBox1.Value = "" or textBox2.Value = "" then
hasError = true
end if
if hasError then
msgBox "You must enter zee information!"
else
'Validation has passed, so in here do your thing.
end if

I'm using a boolean (true or false), that is set to true ONLY IF textBox1 or
textBox2 contains a blank value.
If it does then set hasError (which is teh boolean) to true.

Hope this helped a little bit.

Hope that helped slightly.

End Sub


"JPA" wrote:

Just a clarification from me - the poster of this thread.

I would like the error procedure to run from the form. Blank entries should
not be allowed on the form

The worksheet being written to is hidden and should stay that way (users
should not see it).


"JPA" wrote:


I have a fairly simple issue but am not quite sure what the solution is:

Have created a basic form in Excel with several combo boxes.
The combo drop down values are "Y" or "N".

I have a command button that adds the values to a worksheet and clears the
combo boxes.

How do I prevent users from adding blank values to the worksheet? Ideally,
I would like to create an error routine/procedure which informs the user that
no blank values are allowed and highlights (or moves the cursor to) the field
with the blank value.

Thanks.

JPA.

Reply
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
Validating entries in Excel forms? SteW Excel Discussion (Misc queries) 2 March 1st 07 09:30 PM
User forms to display data Laslett Excel Programming 1 May 15th 05 01:39 AM
User Forms data entry - MM/DD/YYYY UmpaL00mpa Excel Programming 1 November 7th 04 05:28 PM
User Forms - passing data between them mickiedevries Excel Programming 3 June 21st 04 08:59 PM
Using User forms to enter data into lists Saar Ben-Attar Excel Programming 1 May 5th 04 05:02 PM


All times are GMT +1. The time now is 10:01 AM.

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"