By sriggins on Thursday, 20 September 2018
Posted in Excel
Replies 0
Likes 0
Views 3.4K
Votes 0
I have a time card for multiple people. Each time card has a table where the data is entered which then rolls up to a summary sheet. Each table has only one row, I need to make a macro that will enter a new row as needed on each time sheet. I can get the macro to work for one sheet at a time by changing the sheet name on the macro. I need to know how to make a macro that will add a new row, but that can use a wild card for the sheet name, or: I have another macro to dynamically change the sheet name based on the cell value of A1. Is there a way to make VBA, when it's looking for the sheet name reference the value of A1?


Sub NewRow()
Dim ws As Worksheet
Set ws = ActiveSheet
Dim tbl As ListObject
Set tbl = ws.ListObjects("sheet name")
tbl.ListRows.Add
End Sub

Thanks,
View Full Post