Need to edge out the competition for your dream job? Train for certifications today.
' org Macro
' Macro to generate organization chart
' Keyboard Shortcut: Ctrl+j
Dim ogSALayout As SmartArtLayout
Dim QNode As SmartArtNode
Dim QNodes As SmartArtNodes
Dim t As Integer
Set ogSALayout = Application.SmartArtLayouts(92) 'reference to organization chart
Set ogShp = ActiveWorkbook.ActiveSheet.Shapes.AddSmartArt(ogSALayout)
Set QNodes = ogShp.SmartArt.AllNodes
t = QNodes.Count
While QNodes.Count < t
While QNodes.Count < Range("A1").End(xlDown).Row
For i = 1 To Range("A1").End(xlDown).Row
'Promote and demote nodes to put them at the proper level.
While QNodes(Range("A" & i)).Level < Range("C" & i).Value
QNodes(Range("A" & i)).Demote
'Copy the cell text to the node.
QNodes(Range("A" & i)).TextFrame2.TextRange.Text = Range("B" & i)
Open in new window
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Please enter a first name
Please enter a last name
Must be at least 4 characters long.
Join and Comment
Your question, your audience. Choose who sees your identity—and your question—with question security.