Re: Mandatory fields of a "Data Entry UserForm" should be filled serially/chronologically.

Atiqul Haque

New Member
Joined
Dec 13, 2020
Messages
45
Office Version
  1. 2016
Platform
  1. Windows
Good Evening Everybody,

I'll be glad if any one help me to solve the following problems.
Thanks in advance.

=================================
Problem#1
Mandatory fields of a "Data Entry UserForm" should be filled serially/chronologically.

I've a data entry user form of the following:

TextBox1 = Mandatory field
TextBox2 = Optional
TextBox3 = Mandatory field
TextBox4 = Mandatory field
ComboBox1 = Mandatory field
TextBox5 = Mandatory field
ComboBox1 = Mandatory field

I want that the user must fill the mandatory fields serially/chronologically (i.e; firstly textbox1 then textbox3 then textbox4...something like that.), o/wise user can't add any data to the worksheet.

Problem#2

I've 8 (eight) worksheets under a workbook and when i add data in a worksheet by a "data entry form",
i need to copy/paste the same data to all other worksheets at the same time.
 

Attachments

  • Pic of UserForm.JPG
    Pic of UserForm.JPG
    29.9 KB · Views: 7
I also need that, a user can't put data in "textbox2" until he put data in "textbox1"
I described that in Post #2. When the form is activated, set .Enabled for all controls to False. Then when he completes TextBox1, set TextBox2.Enabled = True. And so on for the rest.

if i want to copy data in some specific sheets then what will be the codes?
What do you want to do that is different than the sample file you provided?
 
Upvote 0

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
I described that in Post #2. When the form is activated, set .Enabled for all controls to False. Then when he completes TextBox1, set TextBox2.Enabled = True. And so on for the rest.


What do you want to do that is different than the sample file you provided?
Thank you very much for your reply.
It does not work in a protected workbook & protected worksheets. How can i overcome this situation?
As i'm very new in codding, so it would be great if you can send me the complete code.
Thanks in advance.
 
Upvote 0
It does not work in a protected workbook & protected worksheets. How can i overcome this situation?
In the code use
VBA Code:
Sheet1.Unprotect "password"
' Make your changes here
Sheet1.Protect "password"
Where password it the password used to protect the sheet. If there is no password then just omit it.

As i'm very new in codding, so it would be great if you can send me the complete code.
I'm sure it would be great. We help people by answering questions and solving problems for free, but unfortunately I do not have time to develop an entire project for you.
 
Upvote 0
Solution
In the code use
VBA Code:
Sheet1.Unprotect "password"
' Make your changes here
Sheet1.Protect "password"
Where password it the password used to protect the sheet. If there is no password then just omit it.


I'm sure it would be great. We help people by answering questions and solving problems for free, but unfortunately I do not have time to develop an entire project for you.
Ok sir, i'll try to do it. Thank you very much for your support.
Warm regards,
 
Upvote 0
In the code use
VBA Code:
Sheet1.Unprotect "password"
' Make your changes here
Sheet1.Protect "password"
Where password it the password used to protect the sheet. If there is no password then just omit it.


I'm sure it would be great. We help people by answering questions and solving problems for free, but unfortunately I do not have time to develop an entire project for you.
Problem solved......
 
Upvote 0
In the code use
VBA Code:
Sheet1.Unprotect "password"
' Make your changes here
Sheet1.Protect "password"
Where password it the password used to protect the sheet. If there is no password then just omit it.


I'm sure it would be great. We help people by answering questions and solving problems for free, but unfortunately I do not have time to develop an entire project for you.
My problem#1 has been solved. Sending below the codes for reference.

Private Sub CommandButton1_Click()

If Len(Me.TextBox5.Value) < 11 Then
MsgBox "Incomplete Mobile Number?"
Exit Sub
End If

If TextBox1.Text = “” Then
Cancel = 1
MsgBox "Enter Patient ID"
TextBox1.SetFocus
Exit Sub
End If

If TextBox3.Text = “” Then
Cancel = 1
MsgBox "Enter patient name"
TextBox3.SetFocus
Exit Sub
End If

If TextBox4.Text = “” Then
Cancel = 1
MsgBox "Enter patient age"
TextBox4.SetFocus
Exit Sub
End If

If ComboBox1.Text = “” Then
Cancel = 1
MsgBox "Enter patient gender"
ComboBox1.SetFocus
Exit Sub
End If

If ComboBox2.Text = “” Then
Cancel = 1
MsgBox "Enter Refd. Dr. name"
ComboBox2.SetFocus
Exit Sub
End If


ActiveSheet.Unprotect "639"

Range("c9").Value = TextBox1.Text
Range("f9").Value = TextBox2.Text
Range("c10").Value = TextBox3.Text
Range("i10").Value = TextBox4.Text
Range("c11").Value = TextBox5.Text

Range("m10").Value = ComboBox1.Text
Range("f11").Value = ComboBox2.Text


'clear the data
Me.TextBox1.Value = ""
Me.TextBox2.Value = ""
Me.TextBox3.Value = ""
Me.TextBox4.Value = ""
Me.TextBox5.Value = ""

Me.ComboBox1.Value = ""
Me.ComboBox2.Value = ""

Unload Me

ActiveSheet.Protect "639"

End Sub
 

Attachments

  • Pic#2_Data Entry User Form.JPG
    Pic#2_Data Entry User Form.JPG
    94.1 KB · Views: 3
Upvote 0

Forum statistics

Threads
1,214,795
Messages
6,121,624
Members
449,041
Latest member
Postman24

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