VBA: Insert Icon Based On Table

rwcg2d

New Member
Joined
Jul 11, 2016
Messages
43
I am looking to insert icons based on the category of the entry (not all using that same icon url below). Any ideas on how to combine the Cells(i,n) formula to output the icons? Any other ideas?


Code:
Sub Macro()
 
'Part 1
Dim p As Integer
p = 3
Do While Worksheets("PoAP (Data)").Cells(p, 2).Value <> ""
ActiveSheet.Pictures.Insert( _
        "[URL]https://hubblecontent.osi.office.net/ContentSVC/Content/svg/CallCenter.svg[/URL]"). _
        Select
Selection.ShapeRange.Name = Worksheets("PoAP (Data)").Cells(p, 4)
    p = p + 1
Loop
 
'Part 2
Dim i As Integer
'START ROW
i = 3
Do While Worksheets("PoAP (Data)").Cells(i, 2).Value <> ""
'Sizing
    ActiveSheet.Shapes(Worksheets("PoAP (Data)").Cells(i, 4)).width = Worksheets("PoAP (Data)").Cells(i, 17).Value
    ActiveSheet.Shapes(Worksheets("PoAP (Data)").Cells(i, 4)).height = Worksheets("PoAP (Data)").Cells(i, 15).Value
'Movement
    ActiveSheet.Shapes(Worksheets("PoAP (Data)").Cells(i, 4)).Left = Worksheets("PoAP (Data)").Cells(i, 11)
    ActiveSheet.Shapes(Worksheets("PoAP (Data)").Cells(i, 4)).Top = Worksheets("PoAP (Data)").Cells(i, 13)
    i = i + 1
Loop
 
End Sub
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top