Looking for a less time consuming way to paste in pictures to excel

nlarski

New Member
Joined
May 11, 2017
Messages
17
So I created a picture lookup where depending on a cell value, pictures associated with that value will populate. I have one sheet that is the lookup and another that is the driver which contains every picture. This file is a beast and changing anything is pretty slow.

I am now in the process of updating all of the pictures in the driver sheet and deleting the old. To do this I am copy and pasting the new and then resizing it which takes about 30 seconds per image. The problem is that I have almost 300 images so this has turned into a pretty time consuming and daunting task.

Is there any way that I can simplify or speed up this process? Something like pasting multiple pictures in at a set size?

Thanks!
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Try the below given code and modify it to suit your needs, if necessary. The code; inserts all the *.jpg files found in a folder and imports them on the sheet, starting from cell A1 to downwards.

Code:
Sub ImportPicturesFromFolder()
    PicW = 50
    PicH = 50
    intResult = Application.FileDialog(msoFileDialogFolderPicker).Show
    If intResult <> 0 Then
        strFolder = Application.FileDialog(msoFileDialogFolderPicker).SelectedItems(1)
        Set FSO = CreateObject("Scripting.FileSystemObject")
        Set MyFolder = FSO.GetFolder(strFolder)
            For Each MyFile In MyFolder.Files
                i = i + 1
                If Right(MyFile.Name, 3) = "jpg" Then
                Range("A" & i).Select
                Rows(i).RowHeight = PicH
                PicTop = Range("A" & i).Top
                PicLeft = Range("A" & i).Left
                Set MyPic = ActiveSheet.Shapes.AddPicture(MyFile, True, True, PicLeft, PicTop, PicW, PicH)
                End If
            Next
    End If
    Columns("A:A").ColumnWidth = 15
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,155
Members
453,021
Latest member
Justyna P

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