ManUBlueJay
Active Member
- Joined
- Aug 30, 2012
- Messages
- 326
- Office Version
- 365
- Platform
- Windows
I have been using this code for a couple years with no problem.
This past week it simply does not add a row in my table. No error message but the .listrows.add line is not happening.
Any help to why this is now happening or a fix would be appreciated.
This past week it simply does not add a row in my table. No error message but the .listrows.add line is not happening.
Any help to why this is now happening or a fix would be appreciated.
VBA Code:
Sub InsertNewLine()
Dim Tbl As Object, i As Long
Set Tbl = ActiveSheet.ListObjects(1) 'first table on sheet
With Tbl
If Not Intersect(Selection, .DataBodyRange) Is Nothing Then
i = ActiveCell.Row - .HeaderRowRange.Row
.ListRows.Add (i + 1)
.DataBodyRange.Cells(i + 1, 3) = .DataBodyRange.Cells(i, 3)
.DataBodyRange.Cells(i + 1, 5).Select
End If
End With
End Sub