VBA to create organisation chart

jbesclapez

Active Member
Joined
Feb 6, 2010
Messages
275
Hi there,

I found a great macro on the web that nearly does my job. But only nearly. Unfortunately this code is really high level, and I have no idea how to solve it. Super challenging!
You can download the file here:
orgaproblem
And what I would like to achieve is below: (see picture)
2020-06-12_10-56-36.png

Note that there is a limitation.
The children of G in the second table should only show once in the hierarchy otherwise it will be to messy.

2020-06-12_11-38-31.png



Thanks for your help
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Sure, see post #44 of the original thread below. Maybe I should offer this option…

 
Upvote 0
Thanks. Got it.

What is "Dim lr%"?
 
Upvote 0
It is an integer variable:

VBA Code:
Sub intvar()
Dim var1 As Integer, var2%

var1 = 5
var2 = 9

MsgBox Len(var1) & vbLf & Len(var2)

End Sub
 
Upvote 0
Got the error "the index into the specified collection is out of bound" at this line:

VBA Code:
For i = 1 To 5
   [COLOR=rgb(184, 49, 47)] oshp.SmartArt.AllNodes(1).Delete        ' initial nodes[/COLOR]
 
Upvote 0
I am going offline now for dinner.

We are hijacking the thread; can you start a new one and inform the link?
 
Upvote 0
I am going offline now for dinner.

We are hijacking the thread; can you start a new one and inform the link?


Hi Guys, and thanks for your replies. No worries about the hijack, it is not, you are talking about the solution ehheheh!!!
@Worf what you did is really cool! Unfortunately like @yky I get an error and then it closes my excel.

For me there error seems to be there :
VBA Code:
For i = 1 To 5
    oshp.SmartArt.AllNodes(1).Delete        ' initial nodes
Next


Do you have any idea of this error?

Thanks
 
Upvote 0
Do you have any idea of this error?

Yes. I need to know your Excel version.
 
Upvote 0

Forum statistics

Threads
1,216,581
Messages
6,131,546
Members
449,654
Latest member
andz

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top