Featured Post

Display Pictures on Name Selection From Folders in Excel

In most of applications we require to add pictures of objects, persons or materials in excel so we copy and paste images inside excel and waste much time on re-arranging pictures and sizes. This tutorial covers how to quick add images from folders into excel without copying pictures inside excel. 
Also, we also require to quick add pictures into excel by just selecting name of image so that instead of searching pictures manually in folders we can add feature that quickly add pictures on desired location with name selection.

We will create on drop down menu which shows the all files name placed in certain folder so when we select any name from drop down list a picture auto adds in excel sheet in defined location. 
How to do ?
  • Create two sheets one is main sheet where your application,form or any template is there other sheet is database sheet. In database sheet, we define folder address, drop down list values etc so that you don't need to go into VBA again and again as shown in below figure.
  • From Developer option insert ComboBox drop down list control and Command button as in below figure.

  • In database sheet: address of your pictures folder is defined you can change it for your PC. Also at column A, the list of names of image files placed inside your images folder. This list will be automatically get updated with VBA code given in below steps.

  • We have three types code that need to be written in three location.
    • Code that is for main sheet where image will be displayed after selection.
      • When you create new sheet and open VBA Editor, from right side you will see following options.


    • Code for updating drop down list, when you update drop down values from database sheet it should be updated in drop drown list.
      • With Sheet1, there is always another sheet is created which is ThisWorkbook. Copy paste below code inside ThisWorkbook.
    • Code to read files names placed inside defined folder.
      • This code is a bit lengthy for this go to insert=>module. Inside module copy below code. 

      • Download Code From Here: Download Now
      • After copying code inside module: use this function inside cell to get list of files name placed inside folder
      • =IFERROR(INDEX(GetFileNamesbyExt($A$2,$B$2),ROW()-2),"")
      • Provide folder address at A2 location and extension in B2. Extension is not mandatory and can be skipped. Copy above code inside multiple cells depend upon the number of files. if images are 50 then copy function inside 50 cells.

Watch Complete Tutorial on YouTube


Comments