Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default UserForms - making responses mandatory

I am doing a project which involves collecting H&S data, via a series of
UserForms, and dumping all the information into a worksheet for further
reporting etc.

My current stumbling block is how to make certain fields on the UserForm
mandatory, so that they have to be filled in by the user before they can
close down the form?

Any ideas will be hugely appreciated - it's getting late and I can't sleep
not knowing this!!!
--
Zani
(if I have posted here, I really am stuck!)

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default UserForms - making responses mandatory

Just add a close button to the userform and test in ther. Something like

Private Sub cmdClose_Click()
With TextBox1
If .Text = "" Then
MsgBox "Invalid data"
.SetFocus
Else
Me.Hide
End If
End With
End Sub

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Zani" wrote in message
...
I am doing a project which involves collecting H&S data, via a series of
UserForms, and dumping all the information into a worksheet for further
reporting etc.

My current stumbling block is how to make certain fields on the UserForm
mandatory, so that they have to be filled in by the user before they can
close down the form?

Any ideas will be hugely appreciated - it's getting late and I can't sleep
not knowing this!!!
--
Zani
(if I have posted here, I really am stuck!)



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default UserForms - making responses mandatory

Thanks Bob

Does the trick, why is it always the most simple of things that cause the
most grief!

Thanks again!
--
Zani
(if I have posted here, I really am stuck!)



"Bob Phillips" wrote:

Just add a close button to the userform and test in ther. Something like

Private Sub cmdClose_Click()
With TextBox1
If .Text = "" Then
MsgBox "Invalid data"
.SetFocus
Else
Me.Hide
End If
End With
End Sub

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Zani" wrote in message
...
I am doing a project which involves collecting H&S data, via a series of
UserForms, and dumping all the information into a worksheet for further
reporting etc.

My current stumbling block is how to make certain fields on the UserForm
mandatory, so that they have to be filled in by the user before they can
close down the form?

Any ideas will be hugely appreciated - it's getting late and I can't sleep
not knowing this!!!
--
Zani
(if I have posted here, I really am stuck!)




  #4   Report Post  
Posted to microsoft.public.excel.programming
MaC MaC is offline
external usenet poster
 
Posts: 5
Default UserForms - making responses mandatory

You can also try to insert Bob's code into forms QueryClose event sub, for
example like this:

------
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)

If Len(TextBox1) = 0 Then
MsgBox "You have to insert value in TextBox1"
Cancel = True
End If

End Sub
------

This time user is not able to close form before filling Textbox1.

Good luck

MaC



U¿ytkownik "Zani" napisa³ w wiadomo¶ci
...
Thanks Bob

Does the trick, why is it always the most simple of things that cause the
most grief!

Thanks again!
--
Zani
(if I have posted here, I really am stuck!)



"Bob Phillips" wrote:

Just add a close button to the userform and test in ther. Something like

Private Sub cmdClose_Click()
With TextBox1
If .Text = "" Then
MsgBox "Invalid data"
.SetFocus
Else
Me.Hide
End If
End With
End Sub

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Zani" wrote in message
...
I am doing a project which involves collecting H&S data, via a series

of
UserForms, and dumping all the information into a worksheet for

further
reporting etc.

My current stumbling block is how to make certain fields on the

UserForm
mandatory, so that they have to be filled in by the user before they

can
close down the form?

Any ideas will be hugely appreciated - it's getting late and I can't

sleep
not knowing this!!!
--
Zani
(if I have posted here, I really am stuck!)








  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default UserForms - making responses mandatory

Thanks! Lots of clever people in here!
--
Zani
(if I have posted here, I really am stuck!)



"MaC" wrote:

You can also try to insert Bob's code into forms QueryClose event sub, for
example like this:

------
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)

If Len(TextBox1) = 0 Then
MsgBox "You have to insert value in TextBox1"
Cancel = True
End If

End Sub
------

This time user is not able to close form before filling Textbox1.

Good luck

MaC



U¿ytkownik "Zani" napisa³ w wiadomo¶ci
...
Thanks Bob

Does the trick, why is it always the most simple of things that cause the
most grief!

Thanks again!
--
Zani
(if I have posted here, I really am stuck!)



"Bob Phillips" wrote:

Just add a close button to the userform and test in ther. Something like

Private Sub cmdClose_Click()
With TextBox1
If .Text = "" Then
MsgBox "Invalid data"
.SetFocus
Else
Me.Hide
End If
End With
End Sub

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Zani" wrote in message
...
I am doing a project which involves collecting H&S data, via a series

of
UserForms, and dumping all the information into a worksheet for

further
reporting etc.

My current stumbling block is how to make certain fields on the

UserForm
mandatory, so that they have to be filled in by the user before they

can
close down the form?

Any ideas will be hugely appreciated - it's getting late and I can't

sleep
not knowing this!!!
--
Zani
(if I have posted here, I really am stuck!)











  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default UserForms - making responses mandatory

I would like to do the same - require certain cells in certain worksheets be
mandatory. Where do I copy/paste these suggestions?
-Steven

"Zani" wrote:

Thanks! Lots of clever people in here!
--
Zani
(if I have posted here, I really am stuck!)



"MaC" wrote:

You can also try to insert Bob's code into forms QueryClose event sub, for
example like this:

------
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)

If Len(TextBox1) = 0 Then
MsgBox "You have to insert value in TextBox1"
Cancel = True
End If

End Sub
------

This time user is not able to close form before filling Textbox1.

Good luck

MaC



U¿ytkownik "Zani" napisa³ w wiadomo¶ci
...
Thanks Bob

Does the trick, why is it always the most simple of things that cause the
most grief!

Thanks again!
--
Zani
(if I have posted here, I really am stuck!)



"Bob Phillips" wrote:

Just add a close button to the userform and test in ther. Something like

Private Sub cmdClose_Click()
With TextBox1
If .Text = "" Then
MsgBox "Invalid data"
.SetFocus
Else
Me.Hide
End If
End With
End Sub

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Zani" wrote in message
...
I am doing a project which involves collecting H&S data, via a series

of
UserForms, and dumping all the information into a worksheet for

further
reporting etc.

My current stumbling block is how to make certain fields on the

UserForm
mandatory, so that they have to be filled in by the user before they

can
close down the form?

Any ideas will be hugely appreciated - it's getting late and I can't

sleep
not knowing this!!!
--
Zani
(if I have posted here, I really am stuck!)









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
Making cells mandatory to fill in abfabrob Excel Discussion (Misc queries) 28 April 29th 10 01:23 PM
Making Cells Mandatory and Running Checks Bob Effendi Excel Worksheet Functions 3 January 8th 08 09:14 AM
Making Cell Entry Mandatory Sue T Excel Discussion (Misc queries) 4 August 17th 05 03:45 PM
Is there a way of making data imput in to a cell mandatory before. TerryM Excel Worksheet Functions 0 February 15th 05 11:25 AM
Making Cells mandatory Kathy - Lovullo Excel Programming 4 December 21st 04 04:28 PM


All times are GMT +1. The time now is 06:04 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"