I am trying to get data from my data imput sheet into my record keeping table, so I am trying to do VBA code to
1. create new row
2. paste the data in there as value and not formula
I created something that does work but it is very clanky and can only be applied to one specific data set, and if I want to add more information to my input sheet, or reorder my data, I would need to change the code again, I feel like its not well optimised and quite useless in this way to be frank
Dim newRow As ListRow
Set newRow = ActiveWorkbook.ActiveSheet.ListObjects("Table1").ListRows.Add
With newRow
.Range(1) = ActiveCell
.Range(2) = ActiveCell.Offset(0, 1)
.Range(3) = ActiveCell.Offset(1, 0)
.Range(4) = ActiveCell.Offset(1, 1)
End With
End Sub
I tried to do something like below but it is not working at all
Range("newRow")= Application.WorksheetFunction.TOROW (Range(ActiveCell, ActiveCell.Offset(2, 2)))
Ideally I would like to have code to add row to a table in the same sheet (in any sheet I use), take information from any ctrl a area of data from ActiveCell and fill it only with data given (e.g. my table has 15 rows, and my box has only 6 cells, I would want it to fill only the 6 cells and leave the others empty (they have excel native formulas) )
Is that possible? How to do it, or at least allow multiple selection range in "With .range"?