How to Find Next Row In Excel

Robert Wyatt

Board Regular
Joined
Jul 15, 2012
Messages
88
Office Version
  1. 2019
Platform
  1. Windows
O.K. this might be a long shot, but I trying to put together a year to date where It will load the information from my check stub to the year to date in excel I have Time sheet, Paystub, and Year To Date in three different sheets. I have a formula in VBA that will place everything from my paystub to the year to date page, but I can seem to get it to find the next empty row. I'm past the formula here so yawl can see what I'm talking about. It's the only formula I'm having trouble with I have one of the same thing for my Paid Time Off Register and it works just fine. I would have put the whole thing here, but not sure how to do it with XL2BB.

Sub POSTTOYEARTODATE()
Dim WS1 As Worksheet
Dim WS13 As Worksheet
Dim WS14 As Worksheet

Set WS1 = Worksheets("TimeSheet")
Set WS13 = Worksheets("PayStub")
Set WS14 = Worksheets("YearToDate")

' Figure out which row is the next row
NextRow = WS14.Cells(Rows.Count, 1).End(x1Up).Row + 1


' Copy formats\formulas from Row above
If NextColumn > 2 Then
WS14.Rows(NextRow - 1).AutoFill Destination:=WS14.Rows(NextRow - 1).Resize(2)
End If

' Write the important values to Register
WS14.Cells(NextRow, 1).Resize(1, 29).Value = Array(WS14.Range("D15"), WS14.Range("D16"), _
WS14.Range("D17"), WS14.Range("D18"), WS14.Range("D19"), WS14.Range("D20"), WS14.Range("D21"), _
WS14.Range("D22"), WS14.Range("D26"), WS14.Range("D27"), WS14.Range("D28"), WS14.Range("D32"), _
WS14.Range("D33"), WS14.Range("D34"), WS14.Range("D35"), WS14.Range("D39"), WS14.Range("D40"), _
WS14.Range("D41"), WS14.Range("D45"), WS14.Range("D46"), WS14.Range("D47"), WS14.Range("D48"), _
WS14.Range("D49"), WS14.Range("D50"), WS14.Range("D51"), WS14.Range("D52"))
End
 
We use XL2BB to post screenshots (click the
1676291100927.png
icon for instructions and the download link (use the Mini Sheet option so we can see the formulas and Column/Row references).
Do not post Jpegs or other images as we can't copy them to Excel.

There is testing forum so you can see how it is appearing (link below)


If you can't use it the other alternative is to use a free file hosting site like www.box.com or www.dropbox.com.
Upload the file, mark it for sharing, paste the link it creates in the thread.
Make sure that you alter any sensitive data before uploading
I need to post all of it so you can see everything I have made up to see where I have gone wrong in writing the formula.
I doubt you need to post all of it, about a dozen lines is normally enough (which is why an XL2BB screenshot is normally enough).

Edit make sure you see post number 10 as we posted at about the same time
 
Upvote 0

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.

Forum statistics

Threads
1,223,236
Messages
6,170,912
Members
452,366
Latest member
TePunaBloke

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