周三,05 2020月
  1 回复
  4K访问
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 查找和替换对话框的替换选项卡。
  • 页:
  • 1
目前还没有回复。