Locked Sheets and Hiding Rows

Newbienew

Active Member
Joined
Mar 17, 2017
Messages
395
Office Version
  1. 2016
Platform
  1. Windows
I am having an issue with my sheets being locked and using a MACRO transition code to hide and unhide rows by clicking on a circle shape . My Transition code hides and unhides rows 16-17. I would like to still hide and unhide these rows even if the sheet is locked. But currently when i lock it, it use the macro button i get an error. Is there anything that i can do or is ther anything that can be done? Thank you for your help in advance
 
I can still do what your macro says, with my edit.

Try changing that row line to Rows("34:38").Hidden = True
While I never encountered your version of that line it did work for me, maybe it has something to do with your version of Excel. ???
 
Upvote 0

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Run-time error '1004':
Unable to set Hidden property of the Range class
 
Upvote 0
1. Are you still running this code by clicking a shape?

2. What is the name of the active sheet?

3. Where (full module name) is the code?
 
Upvote 0
1. Are you still running this code by clicking a shape? Yes

2. What is the name of the active sheet? It's on 12 sheets OCT NOV DEC ....

3. Where (full module name) is the code? I believe its MODULE6 or GPS-TAPS SC HED.xlsm [break] - [module6(code)]
 
Upvote 0
@ BrianJN1
I attempted to use your method but it didn't work out for me either and still got the error
 
Upvote 0
1. Are you still running this code by clicking a shape? Yes

2. What is the name of the active sheet? It's on 12 sheets OCT NOV DEC ....

3. Where (full module name) is the code? I believe its MODULE6 or GPS-TAPS SC HED.xlsm [break] - [module6(code)]
Thanks. Are you able to upload a copy of the workbook, with any sensitive data removed, to a file-share site like DropBox and provide a link here?
 
Upvote 0
Thanks for the link. Your problem is that in that file you have not implemented any of the suggestions from posts 2-5 & so your code cannot hide/unhide rows because the sheet is protected & you have not allowed formatting of rows while protected. :)

So, you need to implement something from those suggestions. Probably the easiest from here is a combination of Brian's suggestion from post #2 & mine from post #3 , with the addition of the password since you are using one. Replace "xxxx" in the code below with your actual password. I am assuming that all the monthly sheets will have the same password.

Code:
Sub transaction1()
  ActiveSheet.Unprotect Password:="xxxx"
  Rows("16:17").Hidden = Not Rows("16:17").Hidden
  ActiveSheet.Protect Password:="xxxx"
End Sub
 
Last edited:
Upvote 0
Oh I m sorry I did do what was suggested when it was posted but i only put this:
Sub transaction1()
ActiveSheet.Unprotect
Rows("16:17").Hidden = Not Rows("16:17").Hidden
ActiveSheet.Protect
End Sub

I did not put the password:="XXXx" on them.
 
Upvote 0

Forum statistics

Threads
1,223,904
Messages
6,175,295
Members
452,633
Latest member
DougMo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top