Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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 |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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 |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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 |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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 |
#6
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to see macro code of a password protected macro without a password? | Excel Worksheet Functions | |||
password | Excel Worksheet Functions | |||
how to automate opening a password protected excel file? e.g. a .xls that has a password set in the security tab. | Excel Worksheet Functions | |||
bypass password when update linking of password protected file | Excel Discussion (Misc queries) | |||
Password help please | Excel Worksheet Functions |