judgejustin
Board Regular
- Joined
- Mar 3, 2014
- Messages
- 150
I am using the following code to insert some data and formatting. It works fine until I try to add protection to one of the sheets. The problem is the section of code that seems to be an issue shouldn't be effected, or at least I don't understand how it could be effected. The part that stops working is when the code pastes the formatting.
I need to unprotect another sheet in this code as well but I was only doing one at the time. Any help would be great. If I can get this one figured out I may need help with protection on the other sheet in the code as well. At this point I just don't know.
I need to unprotect another sheet in this code as well but I was only doing one at the time. Any help would be great. If I can get this one figured out I may need help with protection on the other sheet in the code as well. At this point I just don't know.
Code:
Sub Insert_Record()
'
' Insert_Record Macro
'
'
ActiveWindow.SmallScroll Down:=22
Range("D34:D49").Select
Selection.Copy
ActiveWindow.SmallScroll Down:=13
Range("H54").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=True
Range("H54:AC54").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Inventory Sheet").Select
Range("A5:V5").Select
With Sheets("Inventory Sheet")
.Unprotect "TEST"
Selection.Insert Shift:=xlDown
Selection.PasteSpecial Paste:=xlPasteAllMergingConditionalFormats, Operation _
:=xlNone, SkipBlanks:=False, Transpose:=False
.Protect "TEST"
End With
Sheets("New Record Entry").Select
ActiveWindow.SmallScroll ToRight:=-4
ActiveWindow.SmallScroll Down:=-31
Range("C27:F27").Select
ActiveCell.FormulaR1C1 = ""
Range("F24").Select
ActiveCell.FormulaR1C1 = ""
Range("C24").Select
ActiveCell.FormulaR1C1 = ""
Range("F20").Select
ActiveCell.FormulaR1C1 = ""
Range("C20").Select
ActiveCell.FormulaR1C1 = ""
Range("D16").Select
ActiveCell.FormulaR1C1 = ""
Range("D14").Select
ActiveCell.FormulaR1C1 = ""
Range("D12").Select
ActiveCell.FormulaR1C1 = ""
Range("D10").Select
ActiveCell.FormulaR1C1 = ""
Range("D8").Select
ActiveCell.FormulaR1C1 = ""
Range("D4").Select
ActiveCell.FormulaR1C1 = ""
Range("D6:E6").Select
ActiveCell.FormulaR1C1 = ""
Range("D4").Select
End Sub
Last edited: