Is there anyway(vba codes) to hide formula without protecting sheet?
Is there anyway(vba codes) to hide formula without protecting sheet?
Last edited by KrishnaR; 07-21-2023 at 03:47 PM.
The only way that I can think of is to use VBA to prevent selection of a cell with a formula. You would use the Worksheet_SelectionChange sub for that worksheet, and check for either specific cells you are concerned about, or any cell with a formula. If the cell is selected, the code will select a different cell. You would also want to turn off the Formula Bar because the formula will be visible for a fraction of a second on selection, but the user can just turn it back on again.
Also note that this method does not provide security because it won't work if a user does not enable VBA for the file.
but with your code,i cannot copy or paste in between the cells that has formula. i have formula from O2:O & lrow so i need to hide it.If i use hide n lock features it doesn't work properly.
This is the code i m using.
Please Login or Register to view this content.
Last edited by alansidman; 07-19-2023 at 05:01 PM.
@KrishnaR
Code Tags Added
Your post does not comply with Rule 2 of our Forum RULES. Use code tags around code.
Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.
Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found at http://www.excelforum.com/forum-rule...rum-rules.html
(I have added them for you today. Please take a few minutes to read all Forum Rules and comply in the future.)
However, if you continue to not use code tags, you can expect to have your thread BLOCKED until you add them yourself.
Alan עַם יִשְׂרָאֵל חַי
Change an Ugly Report with Power Query
Database Normalization
Complete Guide to Power Query
Man's Mind Stretched to New Dimensions Never Returns to Its Original Form
I don't see how this code relates to "cannot copy or paste in between the cells". That code puts formulas in blank cells, it does not copy or paste anything. And it should not interact with the code I gave you since you turn off events to do it.
You are adding requirements that you did not include in your first post. I answered just what you gave us to start with.
Please provide a sample file and explain everything you need to do.
i need to hide my formula mentioned in the code,i dnt want formula to be shown even when i click on those respective cells.
Hi,
so you must protect cells and the worksheet or stop to use Excel for a database software
alright thanks
alrigh.thank you for your time.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks