Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private Sub Submit_Click()
- Dim WS As Worksheet
- Dim lastrow As Long
- Dim r As Long
- Dim password As String
- Application.ScreenUpdating = False
- If Not IsNumeric(TextBox1.Text) Then
- On Error GoTo ErrorHandler
- password = TextBox1.Text
- Set WS = ActiveWorkbook.Worksheets("Accounts")
- lastrow = WS.Cells(Rows.Count, "A").End(xlUp).Row
- For r = 2 To lastrow
- If WS.Cells(r, 2) = Label5.Caption Then
- WS.Cells(r, 2).Value = TextBox1.Text
- WS.Cells(r, 3).Value = TextBox2.Text
- WS.Cells(r, 4).Value = TextBox3.Text
- MsgBox "Update Successful", vbInformation
- TextBox1.Text = ""
- Call Edit_Login
- Application.ScreenUpdating = True
- Exit Sub
- End If
- Next
- MsgBox "Data not Found!!", vbCritical
- TextBox1.Text = ""
- Unload Me
- Application.ScreenUpdating = True
- Exit Sub
- ErrorHandler: MsgBox "Sorry an Error occured. " & vbCrLf & Err.Description
- Exit Sub
- End If
- MsgBox "Please Enter Correct Information", vbCritical
- Application.ScreenUpdating = True
- End Sub
- Private Sub Edit_Login()
- Dim Wkbk As Workbook
- Dim txt As String
- Dim txt2 As String
- Dim txt3 As String
- Dim lastrow As Long
- Dim r As Long
- Dim Account As String
- Application.ScreenUpdating = False
- Application.EnableEvents = False
- Application.DisplayAlerts = False
- If Not IsNumeric(TextBox1.Text) Then
- On Error GoTo ErrorHandler
- Account = TextBox1.Text
- Set Wkbk = Workbooks.Open("C:UserskameronDesktopQuality Improvement
- SoftwareLog In.xlsm")
- lastrow = Wkbk.Cells(Rows.Count, "A").End(xlUp).Row
- For r = 2 To lastrow
- If Wkbk.Sheets("Tables").Cells(r, 1) = Label5.Caption Then
- Wkbk.Sheets("Tables").Cells(r, 1).Value = TextBox1.Text
- Wkbk.Sheets("Tables").Cells(r, 2).Value = TextBox2.Text
- Wkbk.Sheets("Tables").Cells(r, 3).Value = TextBox3.Text
- MsgBox "Update Successful", vbInformation
- TextBox1.Text = ""
- TextBox2.Text = ""
- TextBox3.Text = ""
- Unload EditAccount
- Application.ScreenUpdating = True
- Exit Sub
- End If
- Next
- MsgBox "Data not Found!!", vbCritical
- TextBox1.Text = ""
- Unload Me
- Application.ScreenUpdating = True
- Exit Sub
- ErrorHandler: MsgBox "Sorry an Error occured. " & vbCrLf & Err.Description
- Exit Sub
- End If
- MsgBox "Please Enter Correct Information", vbCritical
- Application.ScreenUpdating = True
- Application.EnableEvents = True
- Application.DisplayAlerts = True
- End Sub
Add Comment
Please, Sign In to add comment