How to hide cells that are already locked with VBA

Yoepy

New Member
Joined
Feb 22, 2015
Messages
44
I've created a spreadsheet which has a lot of protected cells, spread all of the sheets. Now that it's finished, I want the cells hidden also (yes I know it would have been easy to do it as I went).

Can one of you brainy people please give me a piece of VBA code, that will find, lock and hide all cells that are already formatted as locked.

Thanks in advance
Yoepy
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
I must not have been clear enough.

I mean Format Cells, Locked and Hidden.

They are all just currently Locked.
 
Upvote 0
I must not have been clear enough.

I mean Format Cells, Locked and Hidden.

They are all just currently Locked.

I understand what you want.

You want to lock Range("A1") and Hide Range("A1") for example.

You can Lock Range("A1") but you cannot Hide Range("A1")

You can hide the formula in the cell but not the cell
 
Upvote 0
No, I don't want to hide Range("A1") I want to hide the formula in the cell as per the second part of your post. I just don't want to go through and find every one and do it manually, there are hundreds.

So what would normally be done Right Click, Format cells, Protection, and tick Locked and Hidden.
 
Upvote 0
In your original post you said:
I want the cells hidden also
.


This is beyond my knowledgebase.
I will continue to monitor this thread to see what I can learn.
 
Upvote 0
Hi,

The simplest way is to Click the upper left corner of the Sheet (there should be a triangular symbol) between Column A and Row 1, right click, Format cells, check the box "Hidden", you're all done.

This will make All cells in the sheet "Hidden" (formulas won't show), even the cells without formulas, but since there're no formulas in those cells, there's nothing to "hide" anyway.
 
Upvote 0
Thanks jtakw. Of course, I don't know why I was trying to complicate it.
 
Last edited:
Upvote 0
You're welcome, over thinking a problem happens quite often.:)
 
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,254
Members
452,623
Latest member
Techenthusiast

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