Caveman1964
Board Regular
- Joined
- Dec 14, 2017
- Messages
- 127
- Office Version
- 2016
- Platform
- Windows
I have user forms and trying to get them to work one after another.
The issue is the first one is still active while second one shows up. The data entered but form still there.
I tried hide and unload but then my data went away.
Any help is appreciated. Here is current code from a NOVICE.
First Form
Private Sub Entercompnum_Click()
Sheets("Do Not Alter").Unprotect "1"
Sheets("Data Collection").Unprotect "1"
Sheets("Complaint Entry").Unprotect "1"
Sheets("Complaint Entry").Select
Range("E5").Select
If compnum.Value = "" Then
missingcompnum.Show
Exit Sub
End If
ActiveCell = compnum.Value
If IsNumeric(compnum) Then
mtch = Application.Match(Title, Worksheets("Data Collection").Columns(1), 0)
If IsError(mtch) Then mtch = Application.Match(CDbl(compnum), Worksheets("Data Collection").Columns(1), 0)
Else
mtch = Application.Match(Title, Worksheets("Data Collection").Columns(1), 0)
End If
If Not IsError(mtch) Then
duplicate1.Show
Worksheets("Complaint Entry").Range("E5").Value = vbNullString
Else
Worksheets("Complaint Entry").Range("E5").Value = compnum
End If
entdatecomprec.Show
End Sub
Second form
Private Sub entcomprecdatebutton_Click()
Sheets("Do Not Alter").Unprotect "1"
Sheets("Data Collection").Unprotect "1"
Sheets("Complaint Entry").Unprotect "1"
Sheets("Complaint Entry").Select
Range("E6").Select
If entcompdatetextbox.Value = "" Then
missingcompnum.Show
Exit Sub
End If
ActiveCell = entcompdatetextbox.Value
Unload Me
End Sub
The issue is the first one is still active while second one shows up. The data entered but form still there.
I tried hide and unload but then my data went away.
Any help is appreciated. Here is current code from a NOVICE.
First Form
Private Sub Entercompnum_Click()
Sheets("Do Not Alter").Unprotect "1"
Sheets("Data Collection").Unprotect "1"
Sheets("Complaint Entry").Unprotect "1"
Sheets("Complaint Entry").Select
Range("E5").Select
If compnum.Value = "" Then
missingcompnum.Show
Exit Sub
End If
ActiveCell = compnum.Value
If IsNumeric(compnum) Then
mtch = Application.Match(Title, Worksheets("Data Collection").Columns(1), 0)
If IsError(mtch) Then mtch = Application.Match(CDbl(compnum), Worksheets("Data Collection").Columns(1), 0)
Else
mtch = Application.Match(Title, Worksheets("Data Collection").Columns(1), 0)
End If
If Not IsError(mtch) Then
duplicate1.Show
Worksheets("Complaint Entry").Range("E5").Value = vbNullString
Else
Worksheets("Complaint Entry").Range("E5").Value = compnum
End If
entdatecomprec.Show
End Sub
Second form
Private Sub entcomprecdatebutton_Click()
Sheets("Do Not Alter").Unprotect "1"
Sheets("Data Collection").Unprotect "1"
Sheets("Complaint Entry").Unprotect "1"
Sheets("Complaint Entry").Select
Range("E6").Select
If entcompdatetextbox.Value = "" Then
missingcompnum.Show
Exit Sub
End If
ActiveCell = entcompdatetextbox.Value
Unload Me
End Sub