L
Legacy 361036
Guest
I have a dropdown that currently everything on a dashboard is changing against depending on which month is selected.
I also have images that I want to show. The images are all hosted online. I have code from another thread (http://www.mrexcel.com/forum/excel-questions/604604-insert-image-url-images-into-cells.html) that lets me embed images based on a URL (A1) in B1. I have several problems that I'd like help to figure out if possible.
Summary: Need a macro to remove images, then load a new image from the web (and not embed itself) based on a dynamic cell with a URL.
Currently I have the URLs loading in Column A on various rows, and I want the images to show in Column B.
My skills with VB are limited, just little tweaks. But I'd love to learn. Thank you!
I also have images that I want to show. The images are all hosted online. I have code from another thread (http://www.mrexcel.com/forum/excel-questions/604604-insert-image-url-images-into-cells.html) that lets me embed images based on a URL (A1) in B1. I have several problems that I'd like help to figure out if possible.
- I need the images to load based on which month is selected. Currently I'm thinking I can hide the URLs in Column A and have them load based on the dropdown. Then the image would load based on that dynamic cell loading the URL. I'm using INDEX-MATCH right now and it's not working with the macro I have. It runs without throwing errors, but no picture loads.
- Each time the macro runs, I'd like to clear the old pictures. Right now each time I run it, it loads the pictures over the old one.
- Ideally I'd like the image to load from the URL online each time and not embed. Is that even possible?
Summary: Need a macro to remove images, then load a new image from the web (and not embed itself) based on a dynamic cell with a URL.
Currently I have the URLs loading in Column A on various rows, and I want the images to show in Column B.
Code:
Sub IMAGE()
Dim Rng As Range
Dim Cell As Range
Dim ws As Worksheet
Dim s As Shape
Set ws = ActiveSheet
Application.ScreenUpdating = False
Show Picture = False
Set Rng = Range("A2:A" & Range("A" & 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 = 220
s.Width = 227
End With
End If
On Error GoTo 0
End With
Next Cell
Application.ScreenUpdating = True
End Sub
My skills with VB are limited, just little tweaks. But I'd love to learn. Thank you!