Find first empty row code

bpgolferguy

Active Member
Joined
Mar 1, 2009
Messages
469
Hi, I currently have this code in my excel form that once data is entered in the form, it looks for the first empty row in the worksheet to start copying the data. Well, row 1 and row 2 in the worksheet it posts the data to are header rows, but my problem is row 3 has some formulas in a couple of the columns, and so I have it hidden and when new data is entered in copies down those formulas from that row. So basically what I'm saying is I want it to skip over row 3 and the first time data is entered start at row 4 then go down from there. Here is the current code:

'find first empty row in database
iRow = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row

How would I modify that so that it will start at row 4 instead of row 3 when I enter in the very first entry into the form? Thanks!
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Try

Code:
iRow = WorksheetFunction.Max(4, ws.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row)
 
Upvote 0

Forum statistics

Threads
1,213,539
Messages
6,114,221
Members
448,554
Latest member
Gleisner2

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