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
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.