First empty row in table

Peltz

Board Regular
Joined
Aug 30, 2011
Messages
87
Hello there.

I've written this code to find the last row in a sheet "ws2".

Code:
Sub Registrering()Dim ws1 As Worksheet, ws2 As Worksheet
Dim Fra As Long, Til As Long
Dim i As Integer
Dim StRw As Integer, EndRw As Integer


Application.ScreenUpdating = False
Set ws1 = Sheets("Rutine")
Set ws2 = Sheets("Kontakt")
Set Tab = Worksheets("KOntakt").ListObjects("Tab")


i = ws2.Cells(Rows.Count, 3).End(xlUp).Offset(1, 0).Row
MsgBox i


For various reasons i want to insert a table in this sheet, and acctually want to find the first empty row in the table. When setting up a table, it sets up the heading, and then one empty row. However, when running this code it finds the row after the first empty row in the table, NOT the first empty row under the heading.


So the question is: What can I do to find the first empty row in the table?
BTW: In my example the header is placed in collumn 3.

Thanks
 
I know this is an old one, but here's my take on it (based on the first column in the table always being filled in)

Dim oWB As Workbook: Set oWB = Application.ThisWorkbook
Dim oWS1 As Worksheet: Set oWS1 = oWB.Worksheets(1)
Dim oLO1 As ListObject: Set oLO1 = oWS1.ListObjects(1)

MsgBox (oLO1.Range.End(xlDown).Offset(IIf(oLO1.Range.End(xlDown) = "", 0, 1)).Address)
 
Upvote 0

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

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