![]() |
Un Protect in Excel 2000
I am trying to do the blow but it keeps coming up with run time errot 1004. I
am new at this and very confused. I need it to run utomatically at the click of a button, any ideas? Private Sub CommandButton1_Click() ' ActiveSheet.Unprotect "helen" Range("C4:C7,H4:H7,C11:C14,H11:H14,C18:C21,G18:H21 ,C25:C28,H25:H28,I25:J28,C32:J34,N28,M29:P32,O21:O 22,F1:I1").Select Range("F1").Activate Selection.ClearContents Range("C4").Select ActiveSheet.Protect Range("a1").Select ActiveCell.FormulaR1C1 = "Select Contract Length" ActiveSheet.Protect "helen" End Sub Cheers Helen |
Un Protect in Excel 2000
You have the first .unprotect line commented out.
Maybe unprotecting the worksheet would be a start. And you have activesheet.protect in the middle. That could cause trouble later on. Maybe.... Option Explicit Private Sub CommandButton1_Click() With Me 'the sheet that holds the button .Unprotect "helen" .Range("C4:C7,H4:H7,C11:C14,H11:H14,C18:C21," & _ "G18:H21,C25:C28,H25:H28,I25:J28," & _ "C32:J34,N28,M29:P32,O21:O22,F1:I1").ClearCont ents .Range("a1").Value = "Select Contract Length" .Protect "helen" End With End Sub If that doesn't work, make sure you indicate what line is causing the trouble. It'll make it easier to guess a solution. Helen0610 wrote: I am trying to do the blow but it keeps coming up with run time errot 1004. I am new at this and very confused. I need it to run utomatically at the click of a button, any ideas? Private Sub CommandButton1_Click() ' ActiveSheet.Unprotect "helen" Range("C4:C7,H4:H7,C11:C14,H11:H14,C18:C21,G18:H21 ,C25:C28,H25:H28,I25:J28,C32:J34,N28,M29:P32,O21:O 22,F1:I1").Select Range("F1").Activate Selection.ClearContents Range("C4").Select ActiveSheet.Protect Range("a1").Select ActiveCell.FormulaR1C1 = "Select Contract Length" ActiveSheet.Protect "helen" End Sub Cheers Helen -- Dave Peterson |
All times are GMT +1. The time now is 03:37 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com