Hiding formula VBA


I need some vba code to hide the formulas in a range of cells "A18:W118"

I have tried to protect the range using locked/hidden and then protect sheet, however my slicers stop working then

Is there a VB solution?

Many thanks
Who is Participating?
ProfessorJimJamConnect With a Mentor Commented:

do the followings

select range "A18:W118"  and then right click then go to cell formatting then select custom formatting and then type three times semicolon ;;;  and then click ok.  then go to view tab and un-mark the formula bar.
Glen RichmondCustomer Reporting Programmer.Commented:
could always hide the formula bar?
Glen RichmondCustomer Reporting Programmer.Commented:
Ofcourse use the VBA recorder to capture the method suggested by ProfessorJimJam to include into VBA.
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Rory ArchibaldCommented:
If you just want to hide those formulas, you have to set the Hidden property and protect the sheet. You haven't indicated what the slicers are used for, or where they are.
Gašper KamenšekConnect With a Mentor Excel MVPCommented:
You should do exactly what you did but in the protect Sheet also select the Edit Objects and Use PivotTable & PivotChart...
You will have the formulas hidden and also, your Slicers will work.
Protect Sheet options
Seamus2626Author Commented:
Thanks guys
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.