You are on page 1of 1

Sub updateRecord()

Dim reply As String


Dim currentRow As Long
Worksheets(1).Unprotect

reply = InputBox("Are you sure you wish to update the record? Type y to update")
If reply = "y" And Range("E2") <> "" And Range("E3") <> "" Then
currentRow = Cells(4, 1)
Cells(currentRow, 3) = Range("E2")
Cells(currentRow, 4) = Range("E3")
Cells(currentRow, 5) = Range("E4")
Cells(currentRow, 6) = Range("E5")
Cells(currentRow, 7) = Range("E6")
Cells(currentRow, 8) = Range("E7")
Cells(currentRow, 9) = Range("E8")
Cells(currentRow, 10) = Range("E9")
Cells(currentRow, 11) = Range("E10")
Cells(currentRow, 12) = Range("E11")
Cells(currentRow, 13) = Range("E12")
Cells(currentRow, 14) = Range("E13")
Cells(currentRow, 15) = Range("E14")
Cells(currentRow, 16) = Range("E15")
Cells(currentRow, 17) = Range("E16")
Cells(currentRow, 18) = Range("E17")
Cells(currentRow, 19) = Range("E18")
Cells(currentRow, 20) = Range("E19")

Else

Range("E2").Select
MsgBox "Nothing to update. Please enter the updated data!"
Exit Sub

End If
Worksheets(1).Protect

End Sub

You might also like