Hello,
I got a macro button to copy a row and paste it right below, I have to press the button numerous of time to get a [x] amount of rows and have to manually delete some rows. Right now what I am trying to do is to Copy a row and Paste it below based on a Call value.
Example:
I want to Copy the Row of Week 2 (Cell A20:H20) and paste it below Week 2 with the amount based on G13.
Need help on this, thanks!!
I got a macro button to copy a row and paste it right below, I have to press the button numerous of time to get a [x] amount of rows and have to manually delete some rows. Right now what I am trying to do is to Copy a row and Paste it below based on a Call value.
Example:
I want to Copy the Row of Week 2 (Cell A20:H20) and paste it below Week 2 with the amount based on G13.
Need help on this, thanks!!
VBA Code:
Sub CopyPasteRows_pl()
'Disable following Excel properties, whilst macro runs
With Application
.Calculation = xlCalculationManual
.EnableEvents = False
.ScreenUpdating = False
End With
'Declare object variables
Dim i As Integer
Dim r As Integer
'Activate sheet
Sheets("Profit-Loss Calc.").Select
'Loop through the numbers of rows down the column
i = Range("A19").End(xlDown).Row
For r = 2 To i
If Range("A" & r) = "2" Then
Range("A" & r).EntireRow.Copy
Range("A" & Rows.Count).End(xlUp).Offset(1, 0).PasteSpecial
'Need to ad the amount based on Cell G13 and if possible delete the button
'So that the Macro is fully funcional based on Cell G13
End If
'Move the next row down the column
Next
'Re-enable Excel properties once macro has run
With Application
.Calculation = xlCalculationAutomatic
.EnableEvents = True
.ScreenUpdating = True
End With
End Sub