I need a macro to copy and insert a row below an existing when a cell had a value within a cell range, below macro insert a blank rows without coping cell value,
to be more specific, I need to when I fill in a cell within a range copy and insert a certain row below of it with this new cell value
Sub new-macro()
Dim rng As Range
Dim cell As Range
Set rng = Range("F2:F12")
For Each cell In rng
If Not IsEmpty(cell.Value) Then
ActiveCell.Offset(1, 0).Select
ActiveCell.EntireRow.Insert
ActiveCell.Offset(1, 0).Select
Else
ActiveCell.Offset(1, 0).Select
End If
Next
End Sub
I found this script but it gives me "subscript out of range", any idea why plz?
Sub insertRowFormatFromAbove()
Worksheets("Insert row").Rows(27).Insert Shift:=xlShiftDown, CopyOrigin:=xlFormatFromLeftOrAbove
End Sub