Hello,

I am trying to write some code that will insert copied rows in a worksheet. I want to prompt the user to specify which row # to copy and how many payments to create (i.e. 3 entered, will insert 2 copied rows). I then want to ask the user for a new amount for each payment (in column G), including overwriting the original value. e.g. 1 row = 3 payments = 2 copied rows inserted = 3 new amounts prompted. However, the following code just asks for 1 new amount and places it in column G of the row number selected. Here is the code :

Dim RowtoCopy As Long
  
  RowtoCopy = Application.InputBox( _
              Prompt:="Row Number of Voucher to Copy", _
              Title:="Voucher Payments", _
              Type:=1)
                  
  If RowtoCopy < 1 Then Exit Sub
  
  Dim HowManyCopies As Long
  
  HowManyCopies = Application.InputBox( _
                  Prompt:="How many Payments within this Voucher?", _
                  Title:="Voucher Payments", _
                  Type:=1) - 1
                  
  If HowManyCopies < 1 Then Exit Sub
  
  Rows(RowtoCopy).Select
  ActiveCell.Offset(1).Resize(HowManyCopies).EntireRow.Insert
  ActiveCell.EntireRow.Copy ActiveCell.Offset(1).Resize(HowManyCopies).EntireRow

  With ActiveCell.Resize(SplitAmount + 1, 1).EntireRow
        For Each oneCell In .Columns("G").Cells:

            SplitAmount = Application.InputBox( _
                          Prompt:="Enter value for " & .Address, _
                          Title:="Split Voucher Payments", _
                          Type:=7)
            If SplitAmount <> False Then oneCell.Value = SplitAmount
    
        Next oneCell
  End With
Where am I going wrong?
Any help much appreciated.