To hide/unhide a column or a row in Excel using VBA, you can use the “Hidden” property. To use this property, you need to specify the column, or the row using the range object and then specify the TRUE/FALSE. Show
Following is the example to consider: 2. In the Format Cells dialog, under Number tab, select Custom from Category list, and then type ;;;** into the textbox under Type. 3. Click OK, now the select cell contents have been masked with asterisks. But the cell contents also can be viewed in the formula bar. 4. Place cursor at the cell you do not want to hide contents, then click Review > Protect Sheet, and uncheck Select unlock cells and Format cells option (other options you can check as you need), then type and confirm the password for protecting the sheet in the popping dialogs. Then the cell contents have been hidden and masked with asterisks. Note: If the cell contents are numeric string, this way only with display the cell contents as blank. Hide rows with #N/A or other specific error values by VBA codeIf you want to mask both numbers and texts, you can apply VBA code. 1. Select the cells you want to encrypt, and press Alt + F11 keys to enable Microsoft Visual Basic for Applications window. 2. Click Insert > Module, then copy and paste below code to the new Module. VBA: Hide #N/A error rows
3. Press F5 key to run the code. And then type password in the popping out dialog, and click the OK button. See screenshot: Tip: 1. For decrypting the cells, you can use below macro code.
2. With the VBA code, the cell contents also can be viewed in formula bar. Encrypt and mask cell contents with asterisk or other stringIf you want to encrypt and mask cell contents with the special string as you need, the Encrypt Cells feature of Kutools for Excel can do a nice favor. 2. This might be handy when you need to calculate intermediate values, but dont want to display them. (But try to use Hide rows / hide columns feature if you can) Remember: This formatting code only blanks out the cell contents from being seen. They contents are still there and accessible for formulas, charts as such. Also know how to display colors in chart data labels using custom cell formatting codes What is your favorite cell formatting trick? Share this tip with your colleagues Get FREE Excel + Power BI TipsSimple, fun and useful emails, once per week.
PrevPreviousConverting Excel to PDF – Everything you need to know NextExcel Formula 1 – Really Fast way to learn Excel FormulasNext Thank you so much for visiting. My aim is to make you awesome in Excel & Power BI. I do this by sharing videos, tips, examples and downloads on this website. There are more than 1,000 pages with all things Excel, Power BI, Dashboards & VBA here. Go ahead and spend few minutes to be AWESOME. Want an AWESOME Excel School made me great at work. 5/5 – Brenda FREE Goodies for you... 100 Excel Formulas List From simple to complex, there is a formula for every occasion. Check out the list now. 20 Excel Templates Calendars, invoices, trackers and much more. All free, fun and fantastic. 13 Advanced Pivot Table Skills Power Query, Data model, DAX, Filters, Slicers, Conditional formats and beautiful charts. It's all here. Get started with Power BI Still on fence about Power BI? In this getting started guide, learn what is Power BI, how to get it and how to create your first report from scratch. Recent Articles on Chandoo.org Advanced Excel Skills are highly sought after. Use this FREE Excel roadmap to learn and grow you Excel skills in 3 months. The Excel MandelbrotFREE Calendar & Planner Excel Template for 2023Merry Christmas & Happy New Year 2023Range Lookup in Excel – How to lookup the pricing tier? [Formulas]Best of the lot
Related TipsLearn Excel Learn Advanced Excel – 3 Month Roadmap with ResourcesLearn Excel FREE Calendar & Planner Excel Template for 2023Learn Excel Range Lookup in Excel – How to lookup the pricing tier? [Formulas]Learn Excel #### in Excel cellLearn Excel How to connect to a SINGLE file on SharePoint from Power Query (Fix Unable to Connect Error)Learn Excel FIFA 2022 World Cup Schedule & Results – Excel [FREE Download]57 Responses to “How to Hide a Cell’s Contents in Excel? [Quick Tip]”
|