This code used to add a row to a table, My problem is, the row that is added does not contain formulas, I would like all formulas in the row above to be carried down to the newly inserted row.
Any suggestions?
Any suggestions?
VBA Code:
[
Option Explicit
Dim LObj As ListObject
Private Sub Removeusernow_Click()
Dim i&
i = ComboBox1.ListIndex
If i = -1 Then MsgBox "Non-existent name: remove cancelled.": Exit Sub
ComboBox1.RowSource = ""
LObj.ListRows(1 + i).Delete
ComboBox1.RowSource = LObj.Name
Unload Me
End Sub
Private Sub UserForm_Initialize()
Set LObj = Range("Tabla1").ListObject
ComboBox1.RowSource = LObj.Name
End Sub
Private Sub Addusernow_Click()
Dim i&
i = ComboBox1.ListIndex
If i > -1 Then MsgBox "Existing name: addition cancelled.": Exit Sub
ComboBox1.RowSource = ""
If ComboBox1 < LObj.Range(2, 1) Then
LObj.ListRows.Add(1).Range(1) = ComboBox1
Else
i = WorksheetFunction.Match(ComboBox1, LObj.ListColumns(1).DataBodyRange)
If i < LObj.ListRows.Count Then
LObj.ListRows.Add(1 + i).Range(1) = ComboBox1
Else
LObj.ListRows.Add.Range(1) = ComboBox1
End If
End If
ComboBox1.RowSource = LObj.Name
Unload Me
End Sub
/CODE]