Find a value then copy a picture using offset

knight21

New Member
Joined
Dec 22, 2020
Messages
3
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
I am trying to copy a picture using offset but I am not getting any data upon pasting.

  • f.Offset(11, -8) is merged.
  • I tested using f.Offset(11, -8).select on vba, then right-click copy, then paste to another sheet. I am getting the image, although not the right size.
Here is my code:

VBA Code:
Sub Button1_Click()
Application.CopyObjectsWithCells = True
Set f = ThisWorkbook.Worksheets(1).Cells.Find(What:="C:", LookAt:=xlWhole)
        If Not f Is Nothing Then ' its found
                        f.Offset(11, -8).Copy
                        ThisWorkbook.Worksheets("Sheet2").Range("G10").PasteSpecial
        End If
End Sub
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
My alternate approach that is also not working

VBA Code:
Sub CopyImages()
    Dim shp As Shape
    For Each shp In ThisWorkbook.Worksheets(1).Shapes
        If shp.Type = msoPicture Then
            With shp.TopLeftCell
                If .Offset(-11, 8).Value = "C:" Then shp.Copy
                ThisWorkbook.Worksheets("Sheet2").Paste Range("G10")
            End With
        End If
    Next shp
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,889
Messages
6,175,224
Members
452,620
Latest member
dsubash

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top