trying to copy and past a row from above but at a number in cell a

  • I am trying to write vba to basically copy a row and insert it below the active row with the next number in a sequence. so I would copy a default row and insert it right under the active row and add 1.02 in cell A automatically I just cant figure out where to add the code to this vba or would i have to re-write the code?

    Sub Copypaste()
    Dim ws As Worksheet
    Dim rng As Range

    If MsgBox("Add a new Line?", vbYesNo, "Confirm") = vbYes Then

    Set ws = ThisWorkbook.Sheets("FFE Short")

    With ws

    Set rng = .Rows(ActiveCell.Row)


    rng.Offset(1).Insert Shift:=xlDown

    Application.CutCopyMode = False
    End With
    End If
    End Sub

  • Try this on a copy of your workbook.

    With ActiveCell
            .Offset(1).Insert Shift:=xlDown
        End With
        Cells(ActiveCell.Row + 1, 1).Value = Cells(ActiveCell.Row + 1, 1).Value + 1.02

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!