By sashi7070@gmail.com on Friday, 12 October 2018
Posted in Excel
Replies 0
Likes 0
Views 3.3K
Votes 0
Hello, I need help, this is how my table looks, for example, when I add 2 row at the end of my 1st table, I want the vba help me to do the same thing for the table below (add 2 rows at the end of the table). So my job will be, only need to add rows at the 1st table, the table bellows all will generate rows automatically based on numbers of row in the 1st table. the are the coding I used now to add row for the 1st table. I hope someone can solve this issue for me, thx.

Sub InsertNumRows()

ActiveCell.EntireRow.Copy

Dim Rng As Long

Application.DisplayAlerts = False
On Error Resume Next
Rng = InputBox("Enter number of rows required.")
On Error GoTo 0
Application.DisplayAlerts = True

If Rng = 0 Then
MsgBox "You didn't specify a range!"
Exit Sub

Else
Range(ActiveCell.Offset(1, 0), ActiveCell.Offset(Rng, 0)).Select
Selection.EntireRow.Insert Shift:=xlDown
End If

End Sub [attachment]Capture 1.PNG[/attachment]
View Full Post