简体   繁体   中英

Is there a way to copy a “floating picture” in a specific range and paste it to different sheet with VBA?

在此处输入图片说明

Please refer to the above image for better understanding of my question.

I tried to select the range, copy it and paste it to different sheet but the picture never follows it.

Is there a way to copy a "floating picture" in a specific range and paste it to different sheet with VBA?

Just refer to the Picture's TopLeftCell Property:

Sub PictureMover()
    Dim s As Shape
    For Each s In ActiveSheet.Shapes
        sAddy = s.TopLeftCell.Address(0, 0)
        If sAddy = "A7" Or sAddy = "A8" Then
            s.Copy
            Sheets("Sheet2").Paste
        End If
    Next
End Sub

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM