Doflamingo
Board Regular
- Joined
- Apr 16, 2019
- Messages
- 238
Hi all,
I'm trying to find the lines of code to link the little connectors to a single one.
Here is what I have currently, where the cells above represent the items b of a listbox 2, with a connector for each item, then below there is a cell that contain the value of a textbox.
Currently what I have with the condition that my list box 2 contains 5 items
https://www.dropbox.com/s/uvg353oywi...iddle.png?dl=0
and the goal is to find how to link connectors by a signe one and make appear a little one which would link the big one with the cells containing the text box value
https://www.dropbox.com/s/rby1bdc0u8...20for.png?dl=0
Here is the code of the listbox2 that allows me to displays all the items of the listbox 2 in the same row, with a connector for each item
Dim orig As Range, dest As Range, b%, con As Shape
For b = 0 To ListBox2.ListCount - 1
With Cells(5, b * 2 + 3)
.ColumnWidth = 15
.Value = ListBox2.List(b)
.BorderAround
.HorizontalAlignment = xlCenter
.Borders.Weight = 3
End With
Set orig = Cells(5, b * 2 + 3)
Set dest = Cells(12, b * 2 + 3)
Set con = ActiveSheet.Shapes.AddConnector(1, orig.Left + orig.Width / 2, _
orig.Top + orig.Height, dest.Left + dest.Width / 2, dest.Top)
con.Line.Weight = 1
con.Line.ForeColor.RGB = RGB(0, 0, 0)
Set orig = orig.Offset(, 2)
Set dest = dest.Offset(, 2)
I think I should remove that line
Set dest = Cells(12, b * 2 + 3)
because it decides the lenght of the connectors
And here is the code of the cell containing the textbox value
qty = WorksheetFunction.RoundUp((ListBox2.ListCount * 2 - 1) / 2, 0)
With Cells(10, qty + 2)
.ColumnWidth = 15
.Value = TextBox1.Value
.BorderAround
.HorizontalAlignment = xlCenter
.Borders.Weight = 3
End With
Any ideas ?
I'm trying to find the lines of code to link the little connectors to a single one.
Here is what I have currently, where the cells above represent the items b of a listbox 2, with a connector for each item, then below there is a cell that contain the value of a textbox.
Currently what I have with the condition that my list box 2 contains 5 items
https://www.dropbox.com/s/uvg353oywi...iddle.png?dl=0
and the goal is to find how to link connectors by a signe one and make appear a little one which would link the big one with the cells containing the text box value
https://www.dropbox.com/s/rby1bdc0u8...20for.png?dl=0
Here is the code of the listbox2 that allows me to displays all the items of the listbox 2 in the same row, with a connector for each item
Dim orig As Range, dest As Range, b%, con As Shape
For b = 0 To ListBox2.ListCount - 1
With Cells(5, b * 2 + 3)
.ColumnWidth = 15
.Value = ListBox2.List(b)
.BorderAround
.HorizontalAlignment = xlCenter
.Borders.Weight = 3
End With
Set orig = Cells(5, b * 2 + 3)
Set dest = Cells(12, b * 2 + 3)
Set con = ActiveSheet.Shapes.AddConnector(1, orig.Left + orig.Width / 2, _
orig.Top + orig.Height, dest.Left + dest.Width / 2, dest.Top)
con.Line.Weight = 1
con.Line.ForeColor.RGB = RGB(0, 0, 0)
Set orig = orig.Offset(, 2)
Set dest = dest.Offset(, 2)
I think I should remove that line
Set dest = Cells(12, b * 2 + 3)
because it decides the lenght of the connectors
And here is the code of the cell containing the textbox value
qty = WorksheetFunction.RoundUp((ListBox2.ListCount * 2 - 1) / 2, 0)
With Cells(10, qty + 2)
.ColumnWidth = 15
.Value = TextBox1.Value
.BorderAround
.HorizontalAlignment = xlCenter
.Borders.Weight = 3
End With
Any ideas ?