Kaniguan1969
03-13-2014, 06:05 AM
Hi,
I have a workbook with 4 worksheets and contains a userform. running the workbook i put a codes to hide the 3 sheets contains a data.
When performing a data entry the codes that validate the a duplicate records is not working. I check the active worksheet which should be the transactionDB but upon checking the main sheets is the activate. When the worksheet is unhide this codes is working. Any advice. thanks.
here is my goods.
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim TextBox1_found_blank As Boolean
Dim wb As Workbook
Dim ws As Worksheet
Set wb = ThisWorkbook
Set ws = wb.Sheets("TransactionDB")
--upon checking the active worksheet is not transactionDB
If Me.TextBox1.Value = "" Then
TextBox1_found_blank = True
ElseIf Application.CountIf([A1:A10], Me.TextBox1.Value) > 1 Then
MsgBox "Duplicate Ticket Number Found."
Cancel = True
Exit Sub
Else
TextBox1_found_blank = False
End If
End Sub
I have a workbook with 4 worksheets and contains a userform. running the workbook i put a codes to hide the 3 sheets contains a data.
When performing a data entry the codes that validate the a duplicate records is not working. I check the active worksheet which should be the transactionDB but upon checking the main sheets is the activate. When the worksheet is unhide this codes is working. Any advice. thanks.
here is my goods.
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim TextBox1_found_blank As Boolean
Dim wb As Workbook
Dim ws As Worksheet
Set wb = ThisWorkbook
Set ws = wb.Sheets("TransactionDB")
--upon checking the active worksheet is not transactionDB
If Me.TextBox1.Value = "" Then
TextBox1_found_blank = True
ElseIf Application.CountIf([A1:A10], Me.TextBox1.Value) > 1 Then
MsgBox "Duplicate Ticket Number Found."
Cancel = True
Exit Sub
Else
TextBox1_found_blank = False
End If
End Sub