I have a summary area pulling from other sheets on that are below the table I would like to add names to. The table name is "UserTable" and I want to add first name to 2nd column and want to add last name to the 3rd column. For the time being I have moved it to below the summary and it works fine but would like the final resting place of the summary to be where I have it in the screenshot.
VBA Code:
Private Sub AddUserButton_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Summary")
'find first empty row in database
iRow = ws.Cells.Find(What:="*", SearchOrder:=xlRows, _
SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1
'copy the data to the database
'use protect and unprotect lines,
' with your password
' if worksheet is protected
With ws
' .Unprotect Password:="password"
.Cells(iRow, 26).Value = Me.txtFirstName.Value
.Cells(iRow, 27).Value = Me.txtLastName.Value
' .Protect Password:="password"
End With
'clear the data
Me.txtFirstName.Value = ""
Me.txtLastName.Value = ""
'Focus on First name for another entry
Me.txtFirstName.SetFocus
End Sub