How to get Values Based on the pictures drag into a cell

Subvongola

New Member
Joined
Apr 26, 2017
Messages
5
hi all,

I had created a drag and drop excel sheet whereby there are a total of 5 picture. The user is able to drag around the picture and put them into cell B1 to B3 respectively. After each picture had been drop into the cell, the name of the picture will be display at M5 to M7 respectively.

I had created the drag and drop part. May I know is there a way to retrieve value from each of the pictures drag and dropped into the cells?

if you need he excel sheet for easier reference, I will be greatly to send you.

Please help me. Thank you
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
After putting your images, execute the following macro. It will search the image inside B1 to B3 and put its name in cells M5 to M7

Code:
Sub Name_Picture()
    Dim rng As Range
    Dim img As Object
    Dim cells1, cells2
    Dim i as long
    '
    cells1 = Array("B1", "B2", "B3")
    cells2 = Array("M5", "M6", "M7")
    For i = LBound(cells1) To UBound(cells1)
        Set rng = Range(cells1(i))
        For Each img In ActiveSheet.DrawingObjects
            If Not Intersect(img.TopLeftCell, rng) Is Nothing And _
               Not Intersect(img.BottomRightCell, rng) Is Nothing Then
                Range(cells2(i)).Value = img.Name
                Exit For
            End If
        Next
    Next
End Sub



Try and tell me
 
Upvote 0
After putting your images, execute the following macro. It will search the image inside B1 to B3 and put its name in cells M5 to M7

Code:
Sub Name_Picture()
    Dim rng As Range
    Dim img As Object
    Dim cells1, cells2
    Dim i as long
    '
    cells1 = Array("B1", "B2", "B3")
    cells2 = Array("M5", "M6", "M7")
    For i = LBound(cells1) To UBound(cells1)
        Set rng = Range(cells1(i))
        For Each img In ActiveSheet.DrawingObjects
            If Not Intersect(img.TopLeftCell, rng) Is Nothing And _
               Not Intersect(img.BottomRightCell, rng) Is Nothing Then
                Range(cells2(i)).Value = img.Name
                Exit For
            End If
        Next
    Next
End Sub



Try and tell me


thank you Mr DanteAmor. I placed the code in a button. Tried it but nothing happened.
 
Upvote 0
The image must be completely inside cell B1
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,752
Members
448,989
Latest member
mariah3

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