How to Find Next Row In Excel

Robert Wyatt

Board Regular
Joined
Jul 15, 2012
Messages
102
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
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
The constant is xlUp, not x1Up. (lowercase letter l, not numeral 1)

Rich (BB code):
' Figure out which row is the next row
NextRow = WS14.Cells(Rows.Count, 1).End(xlUp).Row + 1
 
Upvote 0
The constant is xlUp, not x1Up. (lowercase letter l, not numeral 1)

Rich (BB code):
' Figure out which row is the next row
NextRow = WS14.Cells(Rows.Count, 1).End(xlUp).Row + 1
Every time I try to type the l it still comes up as 1 but only in the VBA not anywhere else. I can type l normally here or word but not in Excel. Why?
 
Upvote 0
The default font for VBA code makes it look like a "1". (Personally I have changed mine to a different font.) If you type an "l", it is an "l".
 
Upvote 0
Every time I try to type the l it still comes up as 1 but only in the VBA not anywhere else. I can type l normally here or word but not in Excel. Why?

The default font for VBA code makes it look like a "1". (Personally I have changed mine to a different font.) If you type an "l", it is an "l".
How do I change default font in VBA ?
 
Upvote 0
1676283544042.png



1676283339574.png
 
Upvote 0
Sorry, I'm not understanding your question.
If you mean how do you post all your code, then you just just copy it, paste it in the thread, select the code you have pasted, click the
1676287937049.png
icon at the top of the reply window and click Post reply.

If you mean something else then post back
 
Upvote 0
Sorry, I'm not understanding your question.
If you mean how do you post all your code, then you just just copy it, paste it in the thread, select the code you have pasted, click the View attachment 85267 icon at the top of the reply window and click Post reply.

If you mean something else then post back
Posting just the VBA code wouldn't show you the year to date sheet 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.
 
Upvote 0

Forum statistics

Threads
1,224,828
Messages
6,181,212
Members
453,023
Latest member
alabaz

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