Data entry at the start of data rather than the end

Lakey7

New Member
Joined
Jun 22, 2020
Messages
1
Office Version
  1. 2019
Platform
  1. Windows
Hello

I am using the code below to enter data from my data entry form, but it adds the new entry to the bottom of the data, i have a macro which inserts a new line at the begining of the data set and i want the date to go into that cell rather than at the end, hoping someone can assist :)

Private Sub cmdOK_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("IVDR - Project Tracker")

iRow = Cells(ws.Rows.Count, 1).End(xlUp).Offset(1, 0).Row

With ws
.Cells(iRow, 1).Value = Me.txtID.Value
.Cells(iRow, 2).Value = Me.txtQuote.Value
.Cells(iRow, 3).Value = Me.txtProj.Value
.Cells(iRow, 4).Value = Me.txtCus.Value
.Cells(iRow, 5).Value = Me.txtCon.Value

End With

'clear the data
Me.txtID.Value = ""
Me.txtQuote.Value = ""
Me.txtProj.Value = ""
Me.txtCus.Value = ""
Me.txtCon.Value = ""

Unload Me
End Sub
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Hi & welcome to MrExcel.
What row should the data go on?
 
Upvote 0

Forum statistics

Threads
1,215,494
Messages
6,125,137
Members
449,207
Latest member
VictorSiwiide

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