By lotto009@gmail.com 05年2020月XNUMX日,星期三
張貼在 Excel
回复 1
0
觀看 4.1K
投票 0
親愛的主席先生
我需要 
- 如何在工作表中查找和替換文本 與 VBA 相同的 CTRL+H
我發現 https://www.extendoffice.com/documents/excel/1720-xcel-find-and-replace-chart-title.html  關於文本框和圖表 
如果我需要“在工作表 excel 中查找和替換文本與 VBA 相同的 CTRL+H”
謝謝
藝術
這段代碼我的修改不起作用參考
 Sub TextBoxReplace()
'Updateby20140603
Dim xWs As Worksheet
Dim xFindStr As String
Dim xReplace As String
Dim YY As String
xFindStr = Application.InputBox("Find:", xTitleId, "", Type:=2)
xReplace = Application.InputBox("Replace:", xTitleId, "", Type:=2)
Set xWs = Application.ActiveSheet
On Error Resume Next
For
Each YY In xWs.Worksheest("Sheet1").Range("A2:Z")
xValue = shp.TextFrame.Characters.Text
shp.TextFrame.Characters.Text = VBA.Replace(xValue, xFindStr, xReplace, 1)
Next

Each YY In xWs.Worksheets("Sheet2").Range("A2:Z")
xValue = shp.TextFrame.Characters.Text
shp.TextFrame.Characters.Text = VBA.Replace(xValue, xFindStr, xReplace, 1)
Next
Each YY In xWs.Worksheets("Sheet3").Range("A2:Z")
xValue = shp.TextFrame.Characters.Text
shp.TextFrame.Characters.Text = VBA.Replace(xValue, xFindStr, xReplace, 1)
Next
Each YY In xWs.Worksheets("Sheet4").Range("A2:Z")
xValue = shp.TextFrame.Characters.Text
shp.TextFrame.Characters.Text = VBA.Replace(xValue, xFindStr, xReplace, 1)
Next



End Sub

用另一個值替換一個值
詳細步驟如下。 選擇要替換文本或數字的單元格區域。 要在整個工作表中替換字符,請單擊活動工作表上的任何單元格。 按 Ctrl + H 快捷方式打開 Excel 查找和替換對話框的替換選項卡。
·
3年前
·
0喜歡
·
0票
·
0 個評論
·
查看全文