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

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
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>
 
Upvote 0

Forum statistics

Threads
1,215,036
Messages
6,122,794
Members
449,095
Latest member
m_smith_solihull

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
Back
Top