如何将图像从另一张纸复制到活动纸上 [英] How to copy image from another sheet to active sheet

查看:61
本文介绍了如何将图像从另一张纸复制到活动纸上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经将一些图像插入到Sheet2中,我想将它们复制到我的Sheet1(将是ActieSheet)中.当我在Sheet1的第5行之后的column1中键入图像名称时,将执行该图像复制.我尝试了一些尝试,但没有用,但是,我汇编了几行代码或希望其实现的方式.在这里:

I've inserted some images into Sheet2 and I'd like to copy them into my Sheet1(that will be ActieSheet). That image copy will be executed when I type image names in column1 after 5th row on Sheet1. I've tried few things but they don't work, however, I've assembled few lines of code or the way that I'd like it to be implemented. Here it is:

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

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

Any help will be appreciated. Thanks

推荐答案

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

这篇关于如何将图像从另一张纸复制到活动纸上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆