Hi there,
Hoping someone can help.
I have a code (see below) which enables a user to choose how many cells they would like to insert when running the macro. However, I don't want the inserted cells to adopt the format of the row from which they were inserted below. I want them to have the format of a different row. How can I make this happen? Ideally, before the required number of cells are inserted, Row 'X' (which has the format for which I would like) is copied and this is pasted as formats (and formulas actually) into the newly created cells.
Does this make sense?
Below is current code.....
Sub InsertMultiChildRowsNoFill()
' Disable Excel Features whilst macro runs
Application.Calculation = xlCalculationManual
Application.EnableEvents = False
Application.ScreenUpdating = False
' Declaration of row count variable
Dim iCountRows As Integer
'Trigger input message to appear - in terms of how many rows to insert
iCountRows = Application.InputBox(Prompt:="How many rows do you want to inset, starting with row " _
& ActiveCell.Row & "?", Type:=1)
' Error Handling - end the macro if a zero or negative integer input value is entered
If iCountRows <= 0 Then End
'Based on number of rows specified, insert these rows
Rows(ActiveCell.Row & ":" & ActiveCell.Row + iCountRows - 1).Insert Shift:=xDown
'Re-enable Excel features after macro is un
Application.Calculation = xlCalculationAutomatic
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub
Bookmarks