carefull cause you are going to delete (clear) a column not a row:
Set r1 = tbl.ListColumns(rw).DataBodyRange
r1.ClearContents
for me it works if I call the sub with the Call statement:
Public Sub clear_table_row(tblname As String, rw As Integer)
Dim tbl As ListObject
Dim r1 As Range
Set tbl = ActiveSheet.ListObjects(tblname)
Set r1 = tbl.ListColumns(rw).DataBodyRange
r1.ClearContents
End Function
Public Sub clear_row()
Call clear_table_row("accom_exist", 2)
End Sub
if you want to delete rows use:
Set r1 = tbl.ListRows(rw).Range
Bookmarks