Suuuuper fresh to VBA here.
I've got a table that has many grouped rows all individually under their main banner row that I use for project management that has multiple rounds per project (hence grouped & banner rows). I am trying to add a "Add New Audit" button that adds a new chunk of rows (5 rows, 4 grouped below 1) new projects to the end of the table without having to manually copy and paste the project entry fields. I've included a screenshot of the table I'm working with, and hopefully someone can help with some base code as the code I've gotten thus far towards adding new rows at the end is from other responses that aren't exactly what I need. Namely, they only copy 1 line's formatting and requires the user to know the row to input, whereas I want it to just tack it on to the end.
Here's what I've got:
Private Sub CommandButton1_Click()
Dim rowNum As Long
On Error Resume Next
rowNum = Application.InputBox(Prompt:="Enter Row Number to Add a Row Above:", _
Title:="Add New Row", Type:=1)
Rows(rowNum).Insert Shift:=xlDown
If Err.Number > 0 Then GoTo errH
Range("A" & rowNum - 1).Resize(, 2).Copy Range("A" & rowNum)
Range("D" & rowNum - 1).Resize(, 9).Copy Range("D" & rowNum)
Range("U" & rowNum - 1).Resize(, 7).Copy Range("U" & rowNum)
errH:
End Sub
Thanks for the help!
Also of note, N is the final column in the table, shown at the end of the snip provided.
Thanks in advance.
I've got a table that has many grouped rows all individually under their main banner row that I use for project management that has multiple rounds per project (hence grouped & banner rows). I am trying to add a "Add New Audit" button that adds a new chunk of rows (5 rows, 4 grouped below 1) new projects to the end of the table without having to manually copy and paste the project entry fields. I've included a screenshot of the table I'm working with, and hopefully someone can help with some base code as the code I've gotten thus far towards adding new rows at the end is from other responses that aren't exactly what I need. Namely, they only copy 1 line's formatting and requires the user to know the row to input, whereas I want it to just tack it on to the end.
Here's what I've got:
Private Sub CommandButton1_Click()
Dim rowNum As Long
On Error Resume Next
rowNum = Application.InputBox(Prompt:="Enter Row Number to Add a Row Above:", _
Title:="Add New Row", Type:=1)
Rows(rowNum).Insert Shift:=xlDown
If Err.Number > 0 Then GoTo errH
Range("A" & rowNum - 1).Resize(, 2).Copy Range("A" & rowNum)
Range("D" & rowNum - 1).Resize(, 9).Copy Range("D" & rowNum)
Range("U" & rowNum - 1).Resize(, 7).Copy Range("U" & rowNum)
errH:
End Sub
Thanks for the help!
Also of note, N is the final column in the table, shown at the end of the snip provided.
Thanks in advance.