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
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.
Bookmarks