Created
December 4, 2023 18:52
-
-
Save mjsqu/cb4424286ff5b7008dc4b4b19da8629c to your computer and use it in GitHub Desktop.
Select a range of cells in Excel - creates shapes containing the text in the cells
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub CreateShapes() | |
i = 0 | |
For Each cell In Selection | |
Set shp = ActiveSheet.Shapes.AddShape(msoShapeRectangle, i * 20, i * 20, 72, 20) | |
With shp.TextFrame2 | |
.VerticalAnchor = msoAnchorMiddle | |
.TextRange.ParagraphFormat.Alignment = msoAlignCenter | |
.AutoSize = msoAutoSizeShapeToFitText | |
.WordWrap = msoFalse | |
.TextRange.Characters.Text = cell.Value | |
End With | |
i = i + 1 | |
Next | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment