有誰知道如何在 Excel 中制作一個轉換字串的宏?我想轉換一列中存在的所有字串,以尊重此轉換:
| 最初的 | 宏的結果 |
|---|---|
| 名 | $名 |
| 姓 | $姓氏 |
| 電子郵件 | $電子郵件 |
| 電子郵件2 | $電子郵件2 |
如果它是一個字符,我想在下劃線之后轉換為大寫。
非常感謝 !
uj5u.com熱心網友回復:
記事本 解決方案:
- Ctrl H
- 找什么:
(?:^([^\W_] )|\G(?!^))(?:_([^\W_]*))? - 用。。。來代替:
(?1\$$1)\u$2 - 檢查 環繞
- CHECK 正則運算式
- Replace all
解釋:
(?: # non capture group
^ # beginning of line
( # group 1
[^\W_] # 1 or more non non-word character or underscore
) # end group 1
| # OR
\G(?!^) # restart from last match position, not at the beginning of lie
) # end grroup
(?: # non capture group
_ # underscore
( # group 2
[^\W_]* # 0 or more non non-word character or underscore
) # end group 1
) # end group
替換:
(?1 # if group 1 exists
\$$1 # add a dollar before the group 1
) # endif
\u$1 # uppercase the first letter of group 2
截圖(之前):

截圖(之后):

轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/439849.html
上一篇:使用VBA單擊時如何更改活動單元格的值以及故障排除建議
下一篇:VBAADODB:替換缺失值
