Inserting pictures

Udomakpan - Feb 9, 2019 at 10:18 AM
 Udomakpan - Feb 16, 2019 at 03:16 PM
Please I need help,
I want to insert pictures into a particular sheet remotely without opening the sheet.
And the picture will be base in a certain names stored in a range from another sheet.
Each picture in the folder will carry a unique name store in the cells.
With the click of button the pictures will be inserted automatically all at the same time.
I've view different code but none meet my test.
Expect response soon
My best regards

System Configuration: Android / Chrome 65.0.3325.109

1 response

Blocked Profile
Feb 9, 2019 at 10:41 AM
So, you want a module to crawl through a folder and insert all of the images into a worksheet?

Why does your code not work? What is the flaw with it? Post it here so we can assist you with your code.
This is the code am using,
What it does is to insert the picture from the folder.
But I want this picture to be inserted is a certain cell in another worksheet.
Is it possible?
Please I need your help,
God bless!!

Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range) 'Excel VBA procedure to incorporate Pictures from folder.
Dim rng As Range
Set rng=Application.Intersect(Range("A10:A20"), Target.Cells(1, 1))
If rng Is Nothing Then Exit Sub
GetPicture rng
End Sub

Sub GetPicture(r As Range)
Dim fName As String
Dim s As String

fName="C:\Users\HYMC\Pictures\" & r & ".jpg" 'Change to suit.
s="B" & r.Row
r.RowHeight=75 'pixels
On Error Resume Next
ActiveSheet.Pictures(s).Delete 'Delete the picture
Set pic=ActiveSheet.Pictures.Insert(fName)
On Error GoTo 0
If Not IsEmpty(pic) Then
With pic 'Resize the picture with VBA
End With
End If
End Sub