Thread: password ckeck
View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.misc
excelent excelent is offline
external usenet poster
 
Posts: 695
Default password ckeck

welcome

"Steve" skrev:

On 2 Dec, 11:40, excelent wrote:
iRow i=0 thats why it go wrong
i have inserted a line to dynamic look for next emty cell in Log

Private Sub CommandButton1_Click()
Dim iRow As Long
iRow = Sheets("Log").Cells(1000, 1).End(xlUp).Row + 1
On Error GoTo wrongName
x = Sheets("Data").Range("A1:A100").Find(TextBox1.Valu e,
LookIn:=xlValues).Address

If Range(x).Offset(0, 1) = Val(TextBox2.Value) Then
With Me
Worksheets("Log").Cells(iRow, "a").Value = .TextBox1.Value
Worksheets("Log").Cells(iRow, "b").Value = Format(Now(), "dd-mm-yy" & "_" &
"hh:mm")
Sheets("Steve").Activate
End With
TextBox1 = "": TextBox2 = ""
Unload Me

Else
MsgBox ("Not Ok password"): TextBox2 = ""
End If

Exit Sub

wrongName:
MsgBox ("Not a valid name")
TextBox1 = "": TextBox2 = ""

End Sub

"Steve" skrev:



On 2 Dec, 10:21, excelent wrote:
x = Sheets("Ark1").Range("A1:A100").Find(TextBox1.Valu e,
LookIn:=xlValues).Address


the 2 lines are just 1 line (format messed up)


"excelent" skrev:


oh rename Ark1 to data and maby the range also


"excelent" skrev:


Maby this can give u a hint:


Private Sub TextBox2_AfterUpdate()
On Error GoTo wrongName
x = Sheets("Ark1").Range("A1:A100").Find(TextBox1.Valu e,
LookIn:=xlValues).Address
If Range(x).Offset(0, 1) = Val(TextBox2.Value) Then
MsgBox ("Ok password"): TextBox1 = "": TextBox2 = ""
Else
MsgBox ("Not Ok password"): TextBox2 = ""
End If
Exit Sub
wrongName:
MsgBox ("Not a valid name")
TextBox1 = "": TextBox2 = ""
End Sub


"Steve" skrev:


Hi all,


my question is,


in sheet("data")
I have a list of names in column A and 9 digit numbers in column B


How would i get a userform to check the name and numbers entered in
this page, i have tried Vlookup, but am getting an error message,


any help on the code would be appreciated!


basically i am using a userform with 2 x textbox's


Textbox1 is for username and Textbox2 is for the 9 digit number


i have been able to get the OK button to enable only when 9 digits
have been entered into textbox2 but getting it to check the data in
the sheet("data") is where i have the problem


HYCH


Steve- Hide quoted text -


- Show quoted text -


Many thanks for the tips,


have adjusted as below, but am getting wrong name when i enter a
username and password that are in the list, the list is sorted
alphabetically,


could you review the below code and maybe adjust accordingly. thanks
in advance.


CODE +++++++++++


Private Sub CommandButton1_Click()
Dim iRow As Long


On Error GoTo wrongName
x = Sheets("Data").Range("A1:A100").Find(TextBox1.Valu e,
LookIn:=xlValues).Address


If Range(x).Offset(0, 1) = Val(TextBox2.Value) Then
With Me
Worksheets("Log").Cells(iRow, "a").Value = .TextBox1.Value
Worksheets("Log").Cells(iRow, "b").Value = Format(Now(), "dd-mm-yy" &
"_" & "hh:mm")
Sheets("Steve").Activate
End With
TextBox1 = "": TextBox2 = ""
Unload Me


Else
MsgBox ("Not Ok password"): TextBox2 = ""
End If


Exit Sub


wrongName:
MsgBox ("Not a valid name")
TextBox1 = "": TextBox2 = ""


End Sub


HYCH
Steve- Hide quoted text -


- Show quoted text -


Works a treat many thanks....



Steve