用于更改从另一张工作表链接的形状文本的 VBA 代码

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21847397/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-12 01:58:21  来源:igfitidea点击:

VBA code to change text in shape that link from another sheet

excelvbaexcel-vba

提问by eathapeking

below is my code that i used the second code is working but the function on Text's Shape Dont working well it just show =LIST!A2what it need to show is the number from cell A2 in the sheet name list. i try to modified but seem to now working well

下面是我使用的代码,第二个代码正在工作,但文本形状上的功能运行不正常,它只显示=LIST!A2它需要显示的是工作表名称列表中单元格 A2 中的数字。我尝试修改但现在似乎运行良好

thank in adv. for anyhelp

谢谢。任何帮助

 Sub AFRVIS()
    Dim ws As Worksheet
    Dim sp As Shape
    Set ws = Sheet2
    For Each sp In ws.Shapes


         Sheet2.Shapes.Range("Rounded Rectangle 2").FormulaArray = "=LIST!B2"



    Next
End Sub

Sub NoVIS()
    Dim ws As Worksheet
    Dim sp As Shape
    Set ws = Sheet2
    For Each sp In ws.Shapes

         Sheet2.Shapes.Range(Array("Rounded Rectangle 2")).TextFrame.Characters.Text = "=LIST!A2"


    Next
End Sub

回答by eathapeking

Sheet2.Shapes.Range(Array("Rounded Rectangle 2")).TextFrame.Characters.Text = _
Sheet1.Range("A2")

It is solved now.

现在已经解决了。