跳到主要內容

如何在Excel中將重音字符替換為常規字符?

您是否在Microsoft Excel中收到一些帶有重音符號的報告? 遍歷整個工作簿並用人工將帶重音符號的字符替換為常規字符似乎很乏味,例如“û到“ u”。本文將介紹一些棘手的內容,以便在Excel中用常規字符快速替換重音字符。


用VBA將重音字符替換為常規字符

對於熟悉Microsoft Excel的用戶,使用VBA宏是處理此復雜工作的簡便方法。

1. 按住 其他 + F11 鍵,然後打開 Microsoft Visual Basic for Applications窗口.

2. 點擊 插入 > 模塊,然後將以下宏粘貼到 模塊窗口.

Function StripAccent(thestring As String)
Dim A As String * 1
Dim B As String * 1
Dim i As Integer
Const AccChars= "ŠŽšžŸÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖÙÚÛÜÝàáâãäåçèéêëìíîïðñòóôõöùúûüýÿ"
Const RegChars= "SZszYAAAAAACEEEEIIIIDNOOOOOUUUUYaaaaaaceeeeiiiidnooooouuuuyy"
For i = 1 To Len(AccChars)
A = Mid(AccChars, i, 1)
B = Mid(RegChars, i, 1)
thestring = Replace(thestring, A, B)
Next
StripAccent = thestring
End Function

3. 然後轉到空白單元格並將公式粘貼到單元格中: = CheckStringCHAR(InString),例如 = CheckStringCHAR(“ù”), 或者 = CheckStringCHAR(A2).

筆記:
(1)如果Microsoft Visual Basic不支持Unicode,則可能根本無法識別帶重音的字符。 例如,在Visual Basic中粘貼“š”時,可能會得到“?”。 如果是這樣,則此宏不可用。
(2)它不會直接替換所選單元格字符串中的重音字符。


用Kutools for Excel用普通字符替換重音字符

使用VBA宏需要太多的技能和知識。 而且以下方法將使您僅需單擊幾下即可更輕鬆地工作。 Kutools for Excel的替換重音字符工具使您可以輕鬆地一次用常規字符替換所有重音字符。

Excel的Kutools - 使用 300 多種基本工具增強 Excel 功能。 享受全功能 30 天免費試用,無需信用卡! 立即行動吧!

1. 選擇要替換所有重音字符的範圍。

2. 點擊 庫工具 > 文本 > 替換重音字符…,請參見屏幕截圖:

3. In 替換重音字符 對話框中,單擊 全選 按鈕選擇所有替換規則,然後單擊確定按鈕替換所有重音字符。 看截圖:

筆記:
(1)如果沒有想要的特定重音字符,則可以單擊 添加規則 按鈕,將您自己的規則添加到“替換重音字符”對話框上方的列錶框中。
(2)您可以在“替換重音字符”對話框中自定義新的替換規則。

現在,您將立即將選定範圍內的所有重音字符轉換為常規字符。 看截圖:

替換重音字符 Kutools for Excel的功能可以輕鬆地在整個工作簿中用常規字符替換各種重音字符。 免費試用!

最佳辦公生產力工具

🤖 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 (12)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
How can I replace multiple characters with a single one? For example é with e?
This comment was minimized by the moderator on the site
Dobrý deň, starší súbor xlsm mi vo win11 debuguje na tom, že nevie nájsť meno hárka "Prehľad", má problém s diakritikou.
Nie je problém zmeniť pomenovanie hárka na nové bez diakritiky resp. vyhľadať objekt inak, oveľa väčší problém je však zároveň ten,
že z tohto súboru v exceli pomocou VBA odosielam emaily a ak chcem pomocou VBA napísať telo emailu, tak sa mi v outlooku
menia písmená s diakritikou (č, ď, ť ...) na rôzne zástupné znaky. Email vyzerá nedôstojne a nechcem ho písať ani bez diakritiky,
pretože sme predsa na Slovensku a komunikujeme ešte v materinskej reči...
Môžete mi prosím napísať, či sa tento problém dá odstrániť konkrétnym nastavením windows alebo officu?
V predošlom počítači to fungovalo bez problémov.
Ďakujem pekne.
This comment was minimized by the moderator on the site
I tried that VBA script on my worksheet which had several names with accent characters. This did a nice job of cleaning them up. Thanks.
This comment was minimized by the moderator on the site
I have added the code and it work perfectly however I need to add more accent to the code as I´m missing polish accents. How can I edit the code and add those accents? I try to do it in a notepad and then paste again the code but it change the letter back to normal characters. I'm not an expert so I really need your help please!
This comment was minimized by the moderator on the site
Const AccChars = "ŠŽšžYAÁÂAÄAÇEÉEËIÍÎI?NOóÔOÖUÚUÜÝaáâaäaçeéeëiíîi?noóôoöuúuüýyĄĘĆŁŃóŚŻŹąęćłńóśżź"
Const RegChars = "SZszYAAAAAACEEEEIIIIDNOOOOOUUUUYaaaaaaceeeeiiiidnooooouuuuyyAECLNOSZZaeclnoszz"
This comment was minimized by the moderator on the site
The VBA function StripAccent() worked like a charm, thank you very much for it. But I would like to ask what exactly does this "* 1" at at the end of "Dim A As String * 1" initialization string, I've never seen that before and I wasn't able to find an answer to that myself so far.
This comment was minimized by the moderator on the site
when you remove special character it also remove the space between the text ??
This comment was minimized by the moderator on the site
is it possible to replace multiple characters with another character? There is no way to say I want to replace é by é

How can I do mass replacements like this in Kutools for Excel? I like the multireplace functionality but it would be a lot more useful if replacement of entire words would be possible. Anyboy any idea how I can do this?
This comment was minimized by the moderator on the site
If you are looking to replace a specific accent character (ex. é), you can do a Find and Replace All (search for "é" and replace with "e"). This solved my problem.
This comment was minimized by the moderator on the site
No shit Sherlock
This comment was minimized by the moderator on the site
Hello, Excellent Macro. Thanks for posting this. However I am wondering if I want to replace all of the characters in the excel file, how can I do that at once? Thanks Vivek
This comment was minimized by the moderator on the site
On the "Replace accented characters with regular characters with VBA" part, step 3, you must replace CheckStringCHAR for STRIPACCENT, which is the name of the function in the provided code!
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations