Hi,
I have two worksheets with names User_Logins and Users_Table.
On User_Logins I have info about last logins of a user and who is the current user (Cell F7)
On Users_Table I have info about all users (first row with data is row10.. A10:A50 usernames , B10:B50 passwords etc)
Also , I have made a userform in order usser to change password (three textboxes)
The problem I have is that I know the specific row (loc.row) searching user but on save button I cant access variable.
I think that loc is defined as object and I can access it as string.
My code is the following
Finally, I have a last questionCode:Dim user As Variant Dim pass As Variant Dim loc Dim RangeUsernames As Variant Dim passPassword As Boolean Private Sub CancelButton_Click() Call UserForm_Initialize End Sub Private Sub SaveButton_Click() Dim locationNewPass As String 'Checkings here If passPassword = True Then Msg = MsgBox("Password was successfully validated.", vbInformation, "Change Password") Unload Me 'Sheets("Users_Table").Range("B11").Value = "5555" 'it works 'MsgBox (Sheets("Users_Table").Range("B" & loc.row).Value) 'it does not work MsgBox loc.row End If End Sub Private Sub UserForm_Initialize() oldPassTextBox.Text = "" newPassTextBox.Text = "" confirmPassTextBox.Text = "" oldPassTextBox.SetFocus oldPassTextBox.PasswordChar = "*" newPassTextBox.PasswordChar = "*" confirmPassTextBox.PasswordChar = "*" passPassword = True 'Find User user = Sheets("User_Logins").Range("F7").Value 'Define Range of usernames (for instance A10:A50) Set WS = Worksheets("Users_Table") With WS Set LastCellA = .Cells(.Rows.Count, "A").End(xlUp) End With If LastCellA.row = 10 Then RangeUsernames = "A10" Else RangeUsernames = "A10:A" & LastCellA.row End If 'Find row of data on Users_Table With Sheets("Users_Table").Range(RangeUsernames) Set loc = .Find(What:=user, LookIn:=xlFormulas, _ LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=False) 'If Not loc Is Nothing Then 'MsgBox loc.row 'End If End With pass = loc.Offset(0, 1) End Sub
Because my local language on excel is greek, when I am trying the code
the result is on greek languageCode:Dim myday As String myday = Format(now(), "dddd")
Can I take as result on english ?
Could you help me please ?
Thank you




Reply With Quote
