insert rows and data from above cell
Posted on 2014-12-15
I use the below code provided by Rgonzo to insert cells and the data from above cell including tick boxes which works fine.
However it inserts an entire row and I now need to only insert from A-W and do not want any cells from W >>>> onwards to be impacted.
Can someone provide me with VBA code that will do this please.
theRow = InputBox("Enter Row Number where new row is to be inserted ")
Count = InputBox("how many rows ?")
If IsNumeric(Count) And IsNumeric(theRow) And Count > 0 And theRow > 0 And theRow <= Rows.Count Then
Cells(theRow, 1).Resize(Count, 1).EntireRow.Insert Shift:=xlShiftDown
a = Cells(CLng(theRow) - 1, 1).Address
Cells(CLng(theRow) - 1, 1).EntireRow.Copy Destination:=Range(Cells(theRow, 1), Cells(CLng(theRow) + CLng(Count) - 1, 1))
MsgBox "You didn't enter a valid number!"