Hi Peeps,
I hope someone can help me with my query. I have tried searching on the net but to no avail. What I am trying to do is have "Please type your name here" displayed in the textbox, but when you start typing in something, that disappears.
I also need it do display in another box which says "Please be as descriptive as possible".
Here is my code so far...
Thanks for looking through my query.
I hope someone can help me with my query. I have tried searching on the net but to no avail. What I am trying to do is have "Please type your name here" displayed in the textbox, but when you start typing in something, that disappears.
I also need it do display in another box which says "Please be as descriptive as possible".
Here is my code so far...
Code:
Private Sub UserForm_Click()
End Sub
Private Sub UserForm_Initialize()
'Empty NameTextBox
NameTextBox.Value = ""
'Empty DateTextBox
DateTextBox.Value = Format(Now(), "DD/MM/YY")
'Empty TimeTextBox
TimeTextBox.Value = Format(Now(), "hh:mm")
'Empty WardAreaComboBox
WardAreaComboBox = "Select from list"
'Fill WardAreaComboBox
With WardAreaComboBox
.AddItem "A Ward"
.AddItem "B Ward"
.AddItem "C Ward"
.AddItem "D Ward"
.AddItem "E Ward"
.AddItem "F Ward"
.AddItem "Car Park"
.AddItem "Garden"
.AddItem "*******"
.AddItem "Reception"
.AddItem "Other"
End With
'Empty DescTextBox
DescTextBox.Value = "Please be as descriptive as possible"
'Empty PriorityComboBox
PriorityComboBox = "Select from list"
'Fill PriorityComboBox
With PriorityComboBox
.AddItem "High"
.AddItem "Medium"
.AddItem "Low"
End With
'Set Focus on NameTextBox
NameTextBox.SetFocus
End Sub
Private Sub ClearButton_Click()
Call UserForm_Initialize
End Sub
Private Sub CancelButton_Click()
Unload Me
End Sub
Private Sub OKButton_Click()
If NameTextBox.Value = "" Then
MsgBox "You have forgotten to type in your name", vbCritical
Exit Sub
End If
If WardAreaComboBox.Value = "Select from list" Then
MsgBox "Please select where the issue is located", vbCritical
Exit Sub
End If
If DescTextBox.Value = "Please be as descriptive as possible" Then
MsgBox "Please type in a description of the issue", vbCritical
Exit Sub
End If
If PriorityComboBox.Value = "Select from list" Then
MsgBox "Please select how important the issue is", vbCritical
Exit Sub
End If
EntryUserForm.Hide
Dim emptyRow As Long
'Make Sheet2 active
Sheet2.Activate
'Determine emptyRow
emptyRow = WorksheetFunction.CountA(Range("A:A")) + 1
'Transfer information
Cells(emptyRow, 1).Value = NameTextBox.Value
Cells(emptyRow, 2).Value = DateTextBox.Value
Cells(emptyRow, 3).Value = TimeTextBox.Value
Cells(emptyRow, 4).Value = WardAreaComboBox.Value
Cells(emptyRow, 5).Value = DescTextBox.Value
Cells(emptyRow, 6).Value = PriorityComboBox.Value
Sheet1.Activate
End Sub