MNJ
12-07-2006, 06:34 PM
I did a macro recording for the Cell content macro below. However once I protect the cells, it is unable to clear the content.
I've checked thru the forum but most provide pop up dialog box requesting for a password before run the macro. I do not want this. I need something to force the macro to run even though it's protected.
Below is the code for my Clear Cell Content Macro
Sub ClearCell10()
Range("I40:I44").Select
Selection.Copy
Range("B40").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("B41").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=R[-1]C[6]"
Range("B41").Select
Selection.AutoFill Destination:=Range("B41:B44"), Type:=xlFillDefault
Range("B41:B44").Select
Range("C40:G44,J40:M44").Select
Range("J40").Activate
Selection.ClearContents
End Sub
I've checked thru the forum but most provide pop up dialog box requesting for a password before run the macro. I do not want this. I need something to force the macro to run even though it's protected.
Below is the code for my Clear Cell Content Macro
Sub ClearCell10()
Range("I40:I44").Select
Selection.Copy
Range("B40").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("B41").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=R[-1]C[6]"
Range("B41").Select
Selection.AutoFill Destination:=Range("B41:B44"), Type:=xlFillDefault
Range("B41:B44").Select
Range("C40:G44,J40:M44").Select
Range("J40").Activate
Selection.ClearContents
End Sub