gpt4 book ai didi

excel - 如何将图像从另一张表复制到事件表

转载 作者:行者123 更新时间:2023-12-04 22:07:45 25 4
gpt4 key购买 nike

我在 Sheet2 中插入了一些图片我想把它们复制到我的Sheet1 (这将是 ActieSheet)。当我在 Sheet1 的第 5 行后的 column1 中键入图像名称时,将执行该图像副本.我尝试了一些东西,但它们不起作用,但是,我已经组装了几行代码或我希望它实现的方式。这里是:

Private Sub Worksheet_Change(ByVal Target As Range)

Dim picName As String

If Target.Column = 1 And Target.Row >= 5 Then
picName = Target.Offset(0, 0).Value

'Here goes the rest of the code

End If

End Sub

任何帮助将不胜感激。谢谢

最佳答案

Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
Dim picName As String
If Target.Column = 2 And Target.Row >= 5 Then
picName = Target.Value
Copy_Images picName
End If
End Sub


Private Sub Copy_Images(imageName As String)
Dim sh As Shape
For Each sh In Sheets(2).Shapes
If sh.Name = imageName Then
sh.Copy
Sheets(1).Pictures.Paste
End If
Next
End Sub

关于excel - 如何将图像从另一张表复制到事件表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17023212/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com