Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Function addSimulation()
- ' adds new row of simulation data
- On Error GoTo ERROR
- Dim tbl As ListObject
- Set tbl = ActiveSheet.ListObjects("TabelleSimulation")
- Dim newrow As ListRow
- ' add row on **SECOND** place - only to make sure data validation fields are copied as well
- Set newrow = tbl.ListRows.Add(2)
- With newrow
- .Range(1) = "some data"
- .Range(2) = Date
- .Range(3) = "more data"
- .Range(1).Select ' select a cell, so this row can be moved
- End With
- ' move row one up
- Selection.EntireRow.Cut
- Selection.Offset(-1, 0).EntireRow.Insert shift:=xlDown
- GoTo Ende
- ERROR:
- 'Bei Error:
- GoTo Ende
- Ende:
- ' ENDE!
- End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement