跳到主要內容

三種方法可在Excel中使用星號或其他字符串快速隱藏/隱藏單元格內容

有時,在與其他用戶共享工作簿時,您可能想隱藏一些單元格內容,如下圖所示。 在這裡,本文將介紹三種用星號屏蔽單元格的方法,以在Excel中隱藏內容。
doc遮罩儲存格1


使用格式單元格用星號隱藏和掩蓋單元格內容

在Excel中,要用星號屏蔽單元格內容,可以使用“設置單元格格式”功能。

1.選擇要用星號隱藏的單元格,然後右鍵單擊以選擇 單元格格式 從上下文菜單。
doc遮罩儲存格2

2。 在裡面 單元格格式 對話框下 聯繫電話 標籤,選擇 習俗 類別 列表,然後鍵入 ;;; ** 進入下面的文本框 類別.
doc遮罩儲存格4

3。 點擊 OK,現在所選單元格的內容已被星號遮蓋。
doc遮罩儲存格3

但是單元格內容也可以在編輯欄中查看。
doc遮罩儲存格5

4.將光標置於您不想隱藏內容的單元格上,然後單擊 回顧 > 保護工作表,然後取消選中 選擇解鎖單元格設置單元格格式 選項(您可以根據需要檢查其他選項),然後在彈出對話框中鍵入並確認用於保護工作表的密碼。
doc遮罩儲存格6

然後,單元格內容已被隱藏並用星號掩蓋。

備註:如果單元格內容是數字字符串,則只有將單元格內容顯示為空白時,才採用這種方式。
doc遮罩儲存格7


通過VBA代碼隱藏具有#N / A或其他特定錯誤值的行

如果要同時屏蔽數字和文本,則可以應用VBA代碼。

1.選擇要加密的單元,然後按 Alt + F11鍵 啟用鍵 Microsoft Visual Basic for Applications 窗口。

2。 點擊 插入 > 模塊,然後將以下代碼複製並粘貼到新模塊中。

VBA:隱藏#N / A錯誤行

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。 按 F5 鍵來運行代碼。 然後在彈出的對話框中輸入密碼,然後點擊 OK 按鈕。 看截圖:
doc遮罩儲存格8

小提示:

1.要解密單元,可以使用以下宏代碼。

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.使用VBA代碼,也可以在編輯欄中查看單元格內容。


用星號或其他字符串加密和屏蔽單元格內容

如果您想根據需要使用特殊字符串加密和屏蔽單元格內容,則 加密單元的特徵 Excel的Kutools 可以幫個忙。

Kutools for Excel中的加密單元格工具可以:

1.用空白加密單元格
2.用字符加密單元
3.使用指定的字符串加密單元。

Kutools for Excel 包含 300 個進階工具,可解決您 90% 的 Excel 難題,並為您提供 30 天免費試用。

免費安裝Kutools for Excel(60天免費試用),請按照以下步驟操作。

1.選擇要遮罩的單元格,然後單擊 Kutools 加 > 加密單元.
doc遮罩儲存格9

2.然後在彈出的對話框中,鍵入並確認密碼,然後在 面膜 部分,根據需要檢查選項。
doc遮罩儲存格10

3。 然後點擊 Ok。 目前,所有選定的單元都已被掩蓋。

格紋 與機身相同顏色,單元格顯示一串亂碼。
doc遮罩儲存格11
doc遮罩儲存格12

格紋 燒焦 選項,您可以在文本框中鍵入任何字符,然後單元格將僅顯示該字符。
doc遮罩儲存格13
doc遮罩儲存格14

格紋 選項,然後鍵入要顯示單元格的字符串。
doc遮罩儲存格15
doc遮罩儲存格16

尖端:如果要解密單元格或顯示單元格內容,可以單擊 Kutools 加 > 解密單元,然後輸入密碼以成功解密。
doc遮罩儲存格17


與隱藏相關的其他操作(文章)

根據值隱藏行
本教程提供了一些基於Excel中另一列中的值(等於/大於/小於/小於)隱藏行的方法。

隱藏部分文字字串
有時,您想隱藏字符串的一部分以保護私人信息,例如電話號碼123-xxx-xxxx,該怎麼辦? 在本文中,您將找到簡單的解決方案。

最佳辦公生產力工具

🤖 Kutools 人工智慧助手:基於以下內容徹底改變數據分析: 智慧執行   |  生成代碼  |  建立自訂公式  |  分析數據並產生圖表  |  呼叫 Kutools 函數...
熱門特色: 尋找、突出顯示或識別重複項   |  刪除空白行   |  合併列或儲存格而不遺失數據   |   沒有公式的回合 ...
超級查詢: 多條件VLookup    多值VLookup  |   跨多個工作表的 VLookup   |   模糊查詢 ....
高級下拉列表: 快速建立下拉列表   |  依賴下拉列表   |  多選下拉列表 ....
欄目經理: 新增特定數量的列  |  移動列  |  切換隱藏列的可見性狀態  |  比較範圍和列 ...
特色功能: 網格焦點   |  設計圖   |   大方程式酒吧    工作簿和工作表管理器   |  資源庫 (自動文字)   |  日期選擇器   |  合併工作表   |  加密/解密單元格    按清單發送電子郵件   |  超級濾鏡   |   特殊過濾器 (過濾粗體/斜體/刪除線...)...
前 15 個工具集12 文本 工具 (添加文本, 刪除字符,...)   |   50+ 圖表 類型 (甘特圖,...)   |   40+ 實用 公式 (根據生日計算年齡,...)   |   19 插入 工具 (插入二維碼, 從路徑插入圖片,...)   |   12 轉化 工具 (數字到單詞, 貨幣兌換,...)   |   7 合併與拆分 工具 (高級合併行, 分裂細胞,...)   |   ... 和更多

使用 Kutools for Excel 增強您的 Excel 技能,體驗前所未有的效率。 Kutools for Excel 提供了 300 多種進階功能來提高生產力並節省時間。  點擊此處獲取您最需要的功能...

產品描述


Office選項卡為Office帶來了選項卡式界面,使您的工作更加輕鬆

  • 在Word,Excel,PowerPoint中啟用選項卡式編輯和閱讀,發布者,Access,Visio和Project。
  • 在同一窗口的新選項卡中而不是在新窗口中打開並創建多個文檔。
  • 將您的工作效率提高 50%,每天為您減少數百次鼠標點擊!
Comments (5)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Hola, yo lo solucione asi:
1. Formula: =SI(J7=1;lo que quieren mostrar;"******") y luego,
2. Macro: una macro que descargue el 1 en la celda J7.
3. Boton: un botón que ejecute la macro, puede llamarse mostrar cifrado o algo asi.

De esta manera, se logra solucionar las mascaras u ocultamiento de celdas.
This comment was minimized by the moderator on the site
Is it possible to create a mask email without the email account's password?
This comment was minimized by the moderator on the site
I suggest this:
A1 content               - Expected - foo***********com

Formula:=LEFT(A1,3)&REPT("*",LEN(A1)-6)&RIGHT(A1,3)
Remove left or/and right and change the length to control what to replace with * and what to keep at the beginning or at the end.
This comment was minimized by the moderator on the site
If you want to hide only some parts of the string, here is another way:

=LEFT(A1,3)&REPT("*",LEN(A1)-6)&RIGHT(A1,3)
Explanation:
1. LEFT - Will add some letters from the left of the phrase.2. REPT - Will repeat *, n times. where n can be LEN(A1) or LEN(A1)-X where X is the number fo letters that you want to keep showing3. RIGHT - Will add some letters from the end of the phrase.
If A1 content is formula will result in:
foo***********com
This comment was minimized by the moderator on the site
How do Mask baseon cell value :Sub tra5()Dim selrange As Range
Dim dgstring1, dgstring2, dgstring3, dgstring4 As String
dgstring1 = Sheet1.Range("F26")
dgstring2 = Sheet1.Range("F26")
dgstring3 = Sheet1.Range("F26")
dgstring4 = Sheet1.Range("F26")
dgstring = "dgstring1;dgstring2;dgstring3;dgstring4"
selrange.NumberFormatLocal = dgstring
End Sub

Please help.
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations