Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in
x
or
x
x
Register
x

or

Three methods quickly hide/mask cell contents with asterisk or other string in Excel

Sometimes, you may want to hide some cell contents while you sharing the workbook to other users as below screenshot shown. Here, this article will introduce three methods on masking cells with asterisk for hiding the contents in Excel.
doc mask cell 1

The Encrypt Cells tool in Kutools for Excel can:

1. Encrypt cells with blank
2. Encrypt cells with characters
3. Encrypt cells with a specified string.

Kutools for Excel contains 300 advanced tools for solving your 90% Excel puzzles, and provides you a 60-day free trial.


Hide and mask cell contents with asterisk with Format Cells

In Excel, to mask cell contents with asterisk, you can use the Format Cells function.

1. Select the cells you want to hide with asterisk, then right click to select Format Cells from the context menu.
doc mask cell 2

2. In the Format Cells dialog, under Number tab, select Custom from Category list, and then type ;;;** into the textbox under Type.
doc mask cell 4

3. Click OK, now the select cell contents have been masked with asterisks.
doc mask cell 3

But the cell contents also can be viewed in the formula bar.
doc mask cell 5

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.
doc mask cell 6

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.
doc mask cell 7


Hide rows with #N/A or other specific error values by VBA code

If 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

Sub E_Cells()
'UpdatebyExtendoffice
Dim xRg As Range
Dim xERg As Range
Dim xWs As Worksheet
Dim xStrRg As String
Dim xStrPw As String
xStrPw = ""
xStrPw = Application.InputBox("Enter Password", "", "", Type:=2)
If xStrPw = "" Then Exit Sub
On Error Resume Next
Set xERg = Selection
Set xWs = Application.ActiveSheet
Set xRg = xWs.Cells
xRg.Locked = False
xERg.Locked = True
xERg.NumberFormatLocal = "**;**;**;**"
xWs.Protect Password:=xStrPw, DrawingObjects:=True, Contents:=True, Scenarios:=True
End Sub 

3. Press F5 key to run the code. And then type password in the popping out dialog, and click the OK button. See screenshot:
doc mask cell 8

Tip:

1. For decrypting the cells, you can use below macro code.

Sub D_Cells()
'UpdatebyExtendoffice
Dim xRg As Range
Dim xERg As Range
Dim xWs As Worksheet
Dim xStrRg As String
Dim xStrPw As String
xStrPw = ""
xStrPw = Application.InputBox("Type Password", "", "", Type:=2)
If xStrPw = "" Then Exit Sub
On Error Resume Next
Set xWs = Application.ActiveSheet
Set xRg = xWs.UsedRange
xERg.NumberFormatLocal = "**;**;**;**"
xWs.Unprotect Password:=xStrPw
For Each xERg In xRg
    If xERg.Locked Then xERg.NumberFormatLocal = "@"
Next
End Sub

2. With the VBA code, the cell contents also can be viewed in formula bar.


Encrypt and mask cell contents with asterisk or other string

If 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.

Boots Your Excel With One Excel Suit
300+ professional and easy-used tools for Excel 2019-2003

After free installing Kutools for Excel (60-day free trial), please do as below steps.

1. Select the cells you want to mask, then click Kutools Plus > Encrypt Cells.
doc mask cell 9

2. Then in the popping dialog, type and confirm the password, then in Mask section, check the option as you need.
doc mask cell 10

3. Then click Ok. At present, all selected cells have been masked.

Check None, the cells display a string of gibberish.
doc mask cell 11
doc mask cell 12

Check Char option, you can type any character into the textbox, then the cells will display the character only.
doc mask cell 13
doc mask cell 14

Check String option, then type the string you want the cells display.
doc mask cell 15
doc mask cell 16

Tip: if you want to decrypt the cells or display the cell contents, you can click Kutools Plus > Decrypt Cells, then type the password to successfully decrypt.
doc mask cell 17


Other Operations (Articles) Related To Hidding

Hide rows based on value
This tutorial provides some methods on hiding rows based on the value (equal to/greater than/less than) in another column in Excel.

Hide part of text string
Sometimes, you want to hide part of string to protect the private information, such as phone number 123-xxx-xxxx, how can you do? In this article, you will find the easy solutions.


Kutools for Excel - The Best Office Productivity Tool Increase Your Productivity by 80%

  • Reuse: Quickly insert complex formulas, charts and anything that you have used before; Encrypt Cells with password; Create Mailing List and send emails...
  • Super Formula Bar (easily edit multiple lines of text and formula); Reading Layout (easily read and edit large numbers of cells); Paste to Filtered Range...
  • Merge Cells/Rows/Columns without losing Data; Split Cells Content; Combine Duplicate Rows/Columns... Prevent Duplicate Cells; Compare Ranges...
  • Select Duplicate or Unique Rows; Select Blank Rows (all cells are empty); Super Find and Fuzzy Find in Many Workbooks; Random Select...
  • Exact Copy Multiple Cells without changing formula reference; Auto Create References to Multiple Sheets; Insert Bullets, Check Boxes and more...
  • Extract Text, Add Text, Remove by Position, Remove Space; Create and Print Paging Subtotals; Convert Between Cells Content and Comments...
  • Super Filter (save and apply filter schemes to other sheets); Advanced Sort by month/week/day, frequency and more; Special Filter by bold, italic...
  • Combine Workbooks and WorkSheets; Merge Tables based on key columns; Split Data into Multiple Sheets; Batch Convert xls, xlsx and PDF...
  • More than 300 powerful features. Supports Office/Excel 2007-2019 and 365. Supports all languages. Easy deploying in your enterprise or organization. Full features 60-day free trial.
kte tab 201905

Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
officetab bottom
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.

Be the first to comment.