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
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)

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>
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,167,943
Messages
5,856,432
Members
431,813
Latest member
seconduser

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