Prev Previous Post   Next Post Next
  #11   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 32
Default password ckeck

On 2 Dec, 12:57, excelent wrote:
no thats not right
first it checks if the name is in the range
next it check if the number in same row but column B is eqal to textbox2

"Steve" skrev:



On 2 Dec, 12:07, excelent wrote:
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- Hide quoted text -


- Show quoted text -


lol, i know this may sound alittle dozy but just a quick question if i
read the code right, it will allow access if the values in the two
textboxs are equal,? is this right?


i was hoping to have them enter their name and password and then have
these both checked to see if they match the details that are stored in
sheet("Data")


Just tell me if i am wrong,, lol


have a reasonable understanding of simple VBA, but was lost a little
with this one


Steve- Hide quoted text -


- Show quoted text -


Sorry Steve, When i ran it just now, i had to enter the name in the
password box to get it to run, otherwise it says wrong password


Steve
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to see macro code of a password protected macro without a password? Dmitry Kopnichev Excel Worksheet Functions 5 October 27th 05 09:57 AM
password 123456789 Excel Worksheet Functions 1 September 28th 05 02:00 PM
how to automate opening a password protected excel file? e.g. a .xls that has a password set in the security tab. Daniel Excel Worksheet Functions 0 June 23rd 05 11:56 PM
bypass password when update linking of password protected file Yan Excel Discussion (Misc queries) 1 February 7th 05 11:29 PM
Password help please Tim Zanor Excel Worksheet Functions 3 November 10th 04 10:33 PM


All times are GMT +1. The time now is 01:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"