Hi all, kindly require to provide me a VBA code so that to insert rows below and place exactly the same contents (e.g. numbers, dates, descriptions e.t.c.) as from above rows cells, except the contents in col. "E" and "J". Thank you all in advance
Sub MySpecialCopyMacro()
Dim r As Long
' Capture active row
r = ActiveCell.Row
' Insert new row
Rows(r).Copy
Rows(r + 1).Insert Shift:=xlDown
Application.CutCopyMode = False
' Clear columns E and J
Cells(r + 1, "E").ClearContents
Cells(r + 1, "J").ClearContents
End Sub
which you did not mention originally, but you do not mention exactly how you are marking these rows.I mark the range of rows & columns which i wanted to insert the rows
Sub MySpecialCopyMacro()
Dim fRow As Long, lRow As Long
Dim fCol As Long, lCol As Long
Dim r As Long
Application.ScreenUpdating = False
' Find first and last row and columns in range
fRow = Selection(1).Row
fCol = Selection(1).Column
lRow = Selection.Cells(Selection.Rows.Count, Selection.Columns.Count).Row
lCol = Selection.Cells(Selection.Rows.Count, Selection.Columns.Count).Column
' Loop through all rows going backwards
For r = lRow To fRow Step -1
' Insert new row
Rows(r + 1).Insert Shift:=xlDown
Range(Cells(r, fCol), Cells(r, lCol)).Copy Cells(r + 1, fCol)
Application.CutCopyMode = False
' Clear columns E and J
Cells(r + 1, "E").ClearContents
Cells(r + 1, "J").ClearContents
Next r
Application.ScreenUpdating = True
End Sub