VBA code to hide formula

SKV

Active Member
Joined
Jan 7, 2009
Messages
255
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
 

taurean

Well-known Member
Joined
Jun 17, 2011
Messages
2,179
Office Version
365, 2016
Platform
Windows
Hi SKV,

First link has complete explanation for implementing the code. Did you try it?
 

SKV

Active Member
Joined
Jan 7, 2009
Messages
255
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
 

taurean

Well-known Member
Joined
Jun 17, 2011
Messages
2,179
Office Version
365, 2016
Platform
Windows
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.
 

SKV

Active Member
Joined
Jan 7, 2009
Messages
255
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
 

taurean

Well-known Member
Joined
Jun 17, 2011
Messages
2,179
Office Version
365, 2016
Platform
Windows
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
 

Forum statistics

Threads
1,082,638
Messages
5,366,694
Members
400,914
Latest member
anandkb

Some videos you may like

This Week's Hot Topics

Top