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

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
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,214,924
Messages
6,122,294
Members
449,077
Latest member
Rkmenon

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