+ Reply to Thread
Results 1 to 3 of 3

Create and insert picture into new worksheet with column of URLs

  1. #1
    Registered User
    Join Date
    05-05-2016
    Location
    usa
    MS-Off Ver
    2016
    Posts
    2

    Question Create and insert picture into new worksheet with column of URLs

    I'm pretty green at Macros and only started messing around with them recently, tried googling and copying stuff others have posted but cant seem to figure out what i need.

    I have URL images in column M, M2:M320. Not all cells have a URL some are blank.
    In column N i have labels for the corresponding pictures.
    I would like a macro/function/formula to read a cell in column M, if it has URL post to a second worksheet with the picture and Picture name close by/attached.

    I would prefer all the images/names to print to the single second worksheet and simply start posting lower on the worksheet as needed.
    If i can have a function built in to set the pic size to the pixels i want that would be awesome, else the actual picture size should be fine.

    I plan to start studying/reading up on Macros/VBA but would love to get this working sooner than later for a project im doing at work. Any help would be greatly appreciated!!!

    I took coding a couple years ago in school (its been a while though) and use basic excel weekly so i know enough to stumble around but by no means know what im doing :P
    Last edited by brandonk; 05-05-2016 at 04:58 PM.

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,423

    Re: Create and insert picture into new worksheet with column of URLs

    Big question: is the URL to the picture itself or a page that contains the picture? Also where are the picture names coming from?

    This isn't exactly the best project for a beginner in VBA since it involves cross-applications.

    Also, it will help a lot if you can attach a sample spreadsheet. If you have sample pictures / URLs, zip them and post them too.
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  3. #3
    Registered User
    Join Date
    05-05-2016
    Location
    usa
    MS-Off Ver
    2016
    Posts
    2

    Re: Create and insert picture into new worksheet with column of URLs

    URL is picture itself
    Picture names are coming from another column in the spreadsheet

    Found this finally : (which works partly!! thanks andrew poulsom)
    --------------------------------------------------------------------------------------------
    Sub IMAGE()
    Dim Rng As Range
    Dim Cell As Range
    Dim ws As Worksheet
    Dim s As Shape
    Set ws = ActiveSheet
    Application.ScreenUpdating = False

    Set Rng = Range("n2:n" & Range("n" & Rows.Count).End(xlUp).Row)
    For Each Cell In Rng
    With Cell
    On Error Resume Next
    Set s = ws.Shapes.AddPicture(Cell.Value, False, True, Cell.Offset(, 1).Left, Cell.Offset(, 1).Top, Cell.Offset(, 1).Height, Cell.Offset(, 1).Width)

    If Err <> 0 Then
    Err.Clear
    Else
    With .Offset(, 1)
    s.Top = .Top + 5
    s.Left = .Left + 5
    s.Height = 65
    s.Width = 67
    End With
    End If
    On Error GoTo 0
    End With
    Next Cell

    Application.ScreenUpdating = True
    End Sub
    ------------------------------------------------------------------------------------------
    This will print the first column of URLs pictures right on top/near the URL. Now just need it to read the other two columns (ideally it should read n2, o2, p2 then go to n3, o3, p3 then n4...... etc.
    And position them all an decent size at the bottom and pull the picture name from column D. (note n2, o2, p2 all have the same "picture name")

    Will keep messing around and may try to upload the file to google drive or something so i can show you guys what i have so far.

+ 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. VBA to open URLs in worksheet column, then copy and paste new URL into new column
    By diana310 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-03-2015, 08:47 PM
  2. insert picture on worksheet to userform
    By earlcools in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-16-2014, 07:47 AM
  3. How do I lock picture that I insert in worksheet
    By jamshoot in forum Excel General
    Replies: 0
    Last Post: 07-10-2013, 09:55 AM
  4. VBA for Picture insert at particular worksheet range. Picture name derived from cell.
    By Douglas2013 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-09-2013, 01:16 AM
  5. How to insert a picture (from same worksheet) as background in chart
    By Jacc in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-17-2012, 05:39 AM
  6. Insert picture into userform from hyperlink on worksheet
    By msommerf in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-16-2010, 12:21 PM
  7. Replies: 0
    Last Post: 07-27-2005, 12:05 AM

Tags for this Thread

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