All2Cheesy
Board Regular
- Joined
- Mar 4, 2015
- Messages
- 127
Hi guys,
I've written a Macro that will copy what's in cells and then insert that X amount of times in the cells below(Being used to copy formulas). This works perfectly once I've unlocked the sheet, however, I receive the following error when trying to run this macro in a locked sheet: Runtime Error '1004' Insert method of range class failed.
I've coloured the section that highlights in debug mode in my code below. It is also critical that the sheet remains locked. Thank you in advance!
I've written a Macro that will copy what's in cells and then insert that X amount of times in the cells below(Being used to copy formulas). This works perfectly once I've unlocked the sheet, however, I receive the following error when trying to run this macro in a locked sheet: Runtime Error '1004' Insert method of range class failed.
I've coloured the section that highlights in debug mode in my code below. It is also critical that the sheet remains locked. Thank you in advance!

Code:
Sub AddLines()
Application.Calculation = Manual
Range("A5023:AG5023").Copy
[COLOR="#FF0000"]Range("A5023:AG5023").Resize(Range("Q7").Value).Insert Shift:=xlDown[/COLOR]
Application.Calculation = xlAutomatic
Range("A5024:G65000").Select
Selection.ClearContents
Range("J5024:L65000").Select
Selection.ClearContents
Range("Q5024:T65000").Select
Selection.ClearContents
End Sub