Userform questions

jjhr

New Member
Joined
Nov 30, 2020
Messages
3
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hey people

I have som questions regarding a userform i have made - Basiaclly I have to type in some customer data which i have made but now i want to tweak it a bit - can anybody help?

1) When day add a day to Text_Lastday,Text_1day, Text_Transferdate sometimes they write 18-12-2020 or 18.12.2020 But i want the format always to be 2020-12-18 is that possible?
2) In Text_DOT there can only be 10 digits how do i do that?
3) Before they are able to add a customer they have to fill all fields out % Text_1day how can i do dat?

Thank you





VBA Code:
Option Explicit

Private Sub CommandButton1_Click() '' add customer

Dim TargetRow As Long
Dim DOTName As String


If Sheets("Liste").Range("F2").Value = "NEW" Then

TargetRow = Sheets("Liste").Range("F1").Value + 1 

Else

TargetRow = Sheets("Liste").Range("F3").Value

''Begin validation check

End If

DOTName = Text_DOT


'''Begin Input Data Into Database
Sheets("sager").Range("Data_Start").Offset(TargetRow, 5).Value = TargetRow
Sheets("sager").Range("Data_Start").Offset(TargetRow, 6).Value = Text_1day
Sheets("sager").Range("Data_Start").Offset(TargetRow, 7).Value = Text_Lastday
Sheets("sager").Range("Data_Start").Offset(TargetRow, 8).Value = Tekst_Reason
Sheets("sager").Range("Data_Start").Offset(TargetRow, 9).Value = Text_Transferdate
Sheets("sager").Range("Data_Start").Offset(TargetRow, 10).Value = Text_Inst
Sheets("sager").Range("Data_Start").Offset(TargetRow, 11).Value = Text_DOT
Sheets("sager").Range("Data_Start").Offset(TargetRow, 12).Value = Text_Number
Sheets("sager").Range("Data_Start").Offset(TargetRow, 13).Value = Text_Department
Sheets("sager").Range("Data_Start").Offset(TargetRow, 14).Value = Text_Type


MsgBox "Person With DOT ;" & DOTName & "are added"


Unload AddManual
End Sub
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
1) When day add a day to Text_Lastday,Text_1day, Text_Transferdate sometimes they write 18-12-2020 or 18.12.2020 But i want the format always to be 2020-12-18 is that possible?
Yes its possible whit something like this: Format(TextBoxNameHere.Text, "yyyy-mm-dd")
2) In Text_DOT there can only be 10 digits how do i do that?
On the properties of the textbox, you have one named "MaxLenght" you put a 10 on it.
3) Before they are able to add a customer they have to fill all fields out % Text_1day how can i do dat?
You do a verification whit IF's something like
VBA Code:
If  Text_DOT = "" then exit sub
You can add all the text boxes to do all the verifications.
VBA Code:
If Text_DOT = "" or Text_Number = "" or etc.  then exit sub
 
Upvote 0

Forum statistics

Threads
1,213,539
Messages
6,114,221
Members
448,554
Latest member
Gleisner2

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