Hi!
Can you help me with this code?
Sub MakeHierarchy()
'
'
Dim shpHolder As Shape
Dim objMain As SmartArt
Dim objNode As SmartArtNode
Dim rngData As Range
Dim lngRow As Long
Set rngData = Range("A2:E1000")
Set shpHolder = ActiveSheet.Shapes.AddSmartArt(Application.SmartArtLayouts( _
"urn:microsoft.com/office/officeart/2005/8/layout/orgChart1"))
Set objMain = shpHolder.SmartArt
'clear default nodes
Do While objMain.AllNodes.Count > 1
objMain.AllNodes(objMain.AllNodes.Count).Delete
Loop
lngRow = 1
Set objNode = objMain.AllNodes(1)
objNode.TextFrame2.TextRange.Text = rngData.Cells(lngRow, 3)
For lngRow = 2 To rngData.Rows.Count
lngParentIndex = Application.WorksheetFunction.Match(rngData.Cells(lngRow, 2), rngData.Columns(1), 0)
Set objNode = objMain.AllNodes(lngParentIndex).AddNode(msoSmartArtNodeBelow, msoSmartArtNodeTypeDefault)
objNode.TextFrame2.TextRange.Text = rngData.Cells(lngRow, 3)
Next
End Sub
Sub Macro2()
'
' Macro2 Macro
'
'
Call ActiveSheet.Shapes.AddSmartArt(Application.SmartArtLayouts( _
"urn:microsoft.com/office/officeart/2005/8/layout/orgChart1")).Select
End Sub
for the range... i can't select the filtered section of the chart. do you know the code for me to just select the visible data?
I have just got that code here. hope you can help me with this one.
Also do you know how to make it a button?
Thank you so much in advance...![]()
![]()
![]()
Bookmarks