VBA code to hide formula

SKV

Active Member
Joined
Jan 7, 2009
Messages
257
I have developed a sheet which has couple of formulas.

I want to hide the formula so that the user cannot view the formula and also cannot edit the cell containing the formula.

I can do this by protecting the sheet but it looses the other capabilities like editing non-formula cells etc, filtering etc.

I found some codes on the internet which just lock the view of the cells with formula and does to protect the sheet so the other functionalists are still available to the use. So I really like the code. However for some stupid reason the code is NOT working on my file and I dont know why even though I am following the instructions properly.

The links for the codes are as below
'http://www.teachexcel.com/free-excel-macros/m-36,hide-formulas-prevent-deletion.html
'http://www.computing.net/answers/office/hiding-formulas/8855.html

Please advice as how I can activate this code.

Thanks in advance
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Hi SKV,

First link has complete explanation for implementing the code. Did you try it?
 
Upvote 0
Yes, I followed the instructions to the best of my knowledge but it still doesnot work. I have just started using VBA recently so dont know what exactly I am doing wrong. Can some one check this at their machine and confirm if this code works?

Thanks
 
Upvote 0
One thing you can do is create a sample workbook repeating steps listed and upload it on a file sharing site like box.net. Then we can take a look.
 
Upvote 0
Finally it worked, I was not paying attention to the name of the macro. It was for the workbook and I was putting it in worksheet.

I do have a follow-up question as I find a new issue with this vba

Can we disable a specific macro/VBA code for some time? like during startup. The issue I see is that with this worksheet on selection macro, it is enabled right from the moment the file is open. Now if I run another macro (say to refresh my data) it clashes with this macro as they both try to run simultaneously and thus litterally hang my machine. So I want to put this macro (on selection) on hold as when I am running other macros. Please advice.

thanks
SKV
 
Upvote 0
Without looking at your other macro, it needs the following:
At the beginning of the other code:
Code:
Application.EnableEvents = False
Above line stop the event trigger during your macro run.
At the end code, reset it back to default:
Code:
Application.EnableEvents = True
 
Upvote 0

Forum statistics

Threads
1,213,534
Messages
6,114,186
Members
448,554
Latest member
Gleisner2

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