Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Multiple shape create macro Excel or Word or PP Dear All I came across an occasi

ID: 3561486 • Letter: M

Question

Multiple shape create macro Excel or Word or PP

Dear All

I came across an occasion where I have to make a lot of Shapes,

put text in the shape and set colors based on several conditions which I keep in my excel file.

Basically I have the data prepared and I want the macro to look into the conditions and make the shapes based on the conditions

I made several searches and met this website where it contains information that came closest to what I was hoping to achieve

the problem is the macros on the website are separate , meaning combination of them will get me what I want (they have macros regarding working with

Explanation / Answer

Hi,

This info in Sheet8

Sub Shapes()
   Dim S As Shape
   Dim varShapeInfo As Variant
   Dim i As Integer

   varShapeInfo = Sheets("Sheet8").Range("A1").CurrentRegion
   Sheets.Add
   For i = 2 To UBound(varShapeInfo, 1)
      Set S = ActiveSheet.Shapes.AddShape(CLng(varShapeInfo(i, 1)), Range(varShapeInfo(i, 6)).Left, Range(varShapeInfo(i, 6)).Top, varShapeInfo(i, 7), varShapeInfo(i, 8))
      S.Select
      With Selection.ShapeRange
         .Fill.ForeColor.RGB = RGB(Split(varShapeInfo(i, 3), ",")(0), Split(varShapeInfo(i, 3), ",")(1), Split(varShapeInfo(i, 3), ",")(2))
         .Line.ForeColor.RGB = RGB(Split(varShapeInfo(i, 5), ",")(0), Split(varShapeInfo(i, 5), ",")(1), Split(varShapeInfo(i, 5), ",")(2))
         .TextFrame2.TextRange.Characters.Text = varShapeInfo(i, 2)
         .TextFrame2.TextRange.Font.Fill.ForeColor.ObjectThemeColor = varShapeInfo(i, 4)
      End With
   Next i
End Sub

Shape Text BackColor FontColor BorderColor Position (Cell) Size Width Size Height 1 hello 255,0,0 13 0,0,0 A1 30 30 9 this 0,255,0 10 0,0,0 B5 40 40 9 is 0,0,255 8 0,0,0 C10 70 50 149 great 255,255,0 9 0,0,0 D15 50 50