Home

Error1004 Can you help me with this pleace. Its only happens when the sheet is locked

%3CLINGO-SUB%20id%3D%22lingo-sub-330654%22%20slang%3D%22en-US%22%3EError1004%20Can%20you%20help%20me%20with%20this%20pleace.%20Its%20only%20happens%20when%20the%20sheet%20is%20locked%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-330654%22%20slang%3D%22en-US%22%3E%3CP%3ESub%20D%C3%B6lj()%3CBR%20%2F%3E'%3CBR%20%2F%3E'%20D%C3%B6lj%20Makro%3CBR%20%2F%3E'%3C%2FP%3E%3CP%3E'%3CBR%20%2F%3EColumns(%22E%3AH%22).Select%3CBR%20%2F%3ESelection.EntireColumn.Hidden%20%3D%20True%3CBR%20%2F%3ERows(%2222%3A24%22).Select%3CBR%20%2F%3ERange(%22A24%22).Activate%3CBR%20%2F%3ESelection.EntireRow.Hidden%20%3D%20True%3CBR%20%2F%3ERange(%22A14%22).Select%3CBR%20%2F%3EEnd%20Sub%3CBR%20%2F%3ESub%20Tafram()%3CBR%20%2F%3E'%3CBR%20%2F%3E'%20Tafram%20Makro%3CBR%20%2F%3E'%3C%2FP%3E%3CP%3E'%3CBR%20%2F%3EColumns(%22e%3Ah%22).Select%3CBR%20%2F%3ESelection.EntireColumn.Hidden%20%3D%20False%3CBR%20%2F%3ERows(%2221%3A26%22).Select%3CBR%20%2F%3ESelection.EntireRow.Hidden%20%3D%20False%3CBR%20%2F%3ERange(%22E5%22).Select%3CBR%20%2F%3EEnd%20Sub%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-330654%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-330683%22%20slang%3D%22en-US%22%3ERe%3A%20Error1004%20Can%20you%20help%20me%20with%20this%20pleace.%20Its%20only%20happens%20when%20the%20sheet%20is%20locked%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-330683%22%20slang%3D%22en-US%22%3E%3CP%3EThank%20you%20for%20answer.%3C%2FP%3E%3CP%3EI'ts%20stange!%20When%20i%20protect%20the%20sheet%20its%20possible%20to%20run%20one%20of%20the%20tree%20macros%20but%20not%20the%20other%20two.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-330678%22%20slang%3D%22en-US%22%3ERe%3A%20Error1004%20Can%20you%20help%20me%20with%20this%20pleace.%20Its%20only%20happens%20when%20the%20sheet%20is%20locked%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-330678%22%20slang%3D%22en-US%22%3E%3CP%3EYou%20have%20some%20cells%20locked%20in%20columns%20E%3AH%20so%20when%20the%20sheet%20is%20protected%20you%20cannot%20change%20anything.%20Easy%20way%20is%20unprotect%20the%20sheet%20in%20the%20macro%20then%20re-protect%20it%20when%20macro%20is%20completed%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Tjalle
New Contributor

Sub Dölj()
'
' Dölj Makro
'

'
Columns("E:H").Select
Selection.EntireColumn.Hidden = True
Rows("22:24").Select
Range("A24").Activate
Selection.EntireRow.Hidden = True
Range("A14").Select
End Sub
Sub Tafram()
'
' Tafram Makro
'

'
Columns("e:h").Select
Selection.EntireColumn.Hidden = False
Rows("21:26").Select
Selection.EntireRow.Hidden = False
Range("E5").Select
End Sub

2 Replies
Highlighted

You have some cells locked in columns E:H so when the sheet is protected you cannot change anything. Easy way is unprotect the sheet in the macro then re-protect it when macro is completed

Highlighted

Thank you for answer.

I'ts stange! When i protect the sheet its possible to run one of the tree macros but not the other two.