Saving data from form to next open row on a specific worksheet

gr8trthanu

Board Regular
Joined
Nov 14, 2008
Messages
103
Good Evening,

I have a userform named frmPatients with multiple text boxes and a command button entitled "SAVE".

When I hit the "SAVE" command button the data from all the texboxes is saved to a spreadsheet entitled "Table of Patients"

My problem is that the code is written in such away any new record writes over existing data.

My code does not drop down to the next empty row...

I have searched for possible solutions with no success.

:confused:

Thank You
 

Some videos you may like

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".

gr8trthanu

Board Regular
Joined
Nov 14, 2008
Messages
103
If it helps here is the code I am currently using.

{CODE]
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Private Sub cmdSave_Click()
Dim lRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Table Of Patients")
lRow = ws.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
With ws
.Cells(lRow, 2).Value = txtLast.Value
.Cells(lRow, 2).Value = txtFirst.Value

End With
'Clear input controls.
txtLast.Value = ""

End Sub<strike></strike>
 

Watch MrExcel Video

Forum statistics

Threads
1,122,335
Messages
5,595,573
Members
413,996
Latest member
mabelO

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top