Hi, I'm new to VBA and have done a basics course getting me to the point of creating forms. However, I'm working on a new project where I am trying to write a macro to create a table. So far I have managed to convert a set range to a table, but now I need to add some rows. The number of rows will vary each time I use the sheet: the variant number is in cell F5; so if the value in F5 is 10, then I will need to add 10 rows to the table. The table is named "NewTable" when it is created and this is what I have so far:
Sub CreateTable() ActiveSheet.ListObjects.Add(xlSrcRange, Range("B7:L7"), , xlYes).Name = "NewTable" ActiveCell.End(xlDown).Select ActiveCell.Offset(0, 0).Select End Sub
My question is what do I need to do to add the number of rows as specified in F5 please?