1
最後の行を追加しようとしていますが、最後の行に特定のセルに数式を挿入しようとしています。私が持っているものを動かすと、私は新しく作ったものではなく、最後の行OLDに数式を追加します。あなたは助けてもらえますか?最後の行に式を適用しないでください。
Sub AddDataRow()
Dim tableName As String
Dim sheet As Worksheet
Dim table As ListObject
Dim lastRow As Range
tableName = ActiveSheet.ListObjects(1)
Set sheet = Range(tableName).Parent
Set table = sheet.ListObjects.Item(tableName)
If table.ListRows.Count > 0 Then
Set lastRow = table.ListRows(table.ListRows.Count).Range
If Application.CountBlank(lastRow) < lastRow.Columns.Count Then
table.ListRows.Add
End If
End If
lastRow.Columns("L").Formula = "=A1+B1"
End Sub