+ Reply to Thread
Results 1 to 2 of 2

Inserting multiple images into specific cells

Hybrid View

  1. #1
    Registered User
    Join Date
    03-10-2017
    Location
    Singapore
    MS-Off Ver
    2013
    Posts
    1

    Inserting multiple images into specific cells

    i have multiples image (100+) that i wanted to insert them into specific cells

    those images have file name inclusive of their coordinates ( for eg, pictureX1Y1.jpg and pictureX0Y1.jpg)

    I want to insert them into the cells according to their coordinates

    the coordinates may sometimes vary from X=-6 to X = 6 and Y =-7 and Y=7

    so it sums up there will be 100+ of images to form a collage

    anyone can help?

    Thanks in advance

  2. #2
    Forum Expert
    Join Date
    06-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    1,714

    Re: Inserting multiple images into specific cells

    this macro might get you started. It assumes all the picture files follow the naming convention you described. It takes all the files in the specified directory that conform to that naming pattern, extracts the x and y values and places the pictures in cells using those co-ordinates relative to a central cell (assumed here to be cell N10).

    for this to achieve the effect you want, the cells will have to be resized to roughly the same dimensions as the pictures you import


    Sub pictures_place()
    Dim MyDir, MyPic, CentreCell As Range, xx As Long, yy As Long, ll As Long, rr As Long, Xpos As Long, YPos As Long
    
    
    Set CentreCell = Range("N10")
    
    MyDir = "C:\MyPictures\"
    
    MyPic = Dir(MyDir & "picture*.jpg")
    
    Do While MyPic <> ""
        ll = InStr(LCase(MyPic), "x")
        mm = InStr(LCase(MyPic), "y")
        rr = InStr(LCase(MyPic), ".")
        Xpos = Mid(MyPic, ll + 1, mm - ll - 1)
        YPos = Mid(MyPic, mm + 1, rr - mm)
        CentreCell.Offset(Xpos, YPos).Select
        ActiveSheet.Pictures.Insert(MyDir & MyPic).Select
        MyPic = Dir
        
    Loop
    
    Set CentreCell = Nothing
    End Sub
    Last edited by NickyC; 03-13-2017 at 04:03 AM. Reason: typo

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. inserting multiple images at a time
    By noora82 in forum Excel General
    Replies: 5
    Last Post: 04-16-2015, 07:57 AM
  2. Inserting Multiple Images based on links??
    By vivekmartin in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-06-2015, 04:51 PM
  3. inserting multiple images into spreadsheet
    By the_adam in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-23-2013, 10:06 AM
  4. MAcro for inserting multiple images into rectangles
    By Jagasama in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-03-2012, 10:47 AM
  5. Inserting images into a cell based on another cells value.
    By ccScotty in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-04-2012, 12:08 PM
  6. Excel 2007 : Inserting multiple images
    By Mickmac in forum Excel General
    Replies: 0
    Last Post: 03-08-2011, 05:14 AM
  7. inserting images (jpg) into cells in Excel 2007
    By dpacifico in forum Excel General
    Replies: 1
    Last Post: 03-24-2010, 04:52 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1