VERSION 5.00 Begin {C62A69F0-16DC-11CE-9E98-00AA00574A4F} Registo Caption = "Registo" ClientHeight = 3036 ClientLeft = 108 ClientTop = 456 ClientWidth = 4584 OleObjectBlob = "Registo.frx":0000 StartUpPosition = 1 'CenterOwner End Attribute VB_Name = "Registo" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Private Sub CommandButton1_Click() Dim ultimaLinha As Long Dim ws As Worksheet Set ws = ThisWorkbook.Worksheets("Registos") If (TextBox1.Value = 123) Then ultimaLinha = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row + 1 Range("A" & ultimaLinha).Value = TextBox2.Value Range("B" & ultimaLinha).Value = TextBox3.Value MsgBox "Valor salvo com sucesso!" Unload Registo Login.Show Else MsgBox "Não Têm Permissões!" End If Unload Registo Login.Show End Sub Private Sub CommandButton2_Click() Unload Registo Login.Show End Sub Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer) If CloseMode = vbFormControlMenu Then ' Salva o workbook ThisWorkbook.Save ' Fecha o Excel Application.Quit End If End Sub