top vertical connector for active cell instead of left horizontal connector

Doflamingo

Board Regular
Joined
Apr 16, 2019
Messages
238
Hello all,

Here is the code for any active cell to get left connector.

Code:
'left direction


    l = (ActiveCell.Offset(0, -1).Left)
    r = (ActiveCell.Offset(0, 0).Left)
    t = (ActiveCell.top + ActiveCell.Offset(1, 0).top) / 2
    Set con = ActiveSheet.Shapes.AddConnector(msoConnectorStraight, l, t, r, t)
        con.line.Weight = 1
        con.line.ForeColor.RGB = RGB(0, 0, 0)

What I'm looking for, is for the same active cell, to get TOP VERTICAL connector representing 3 cells ABOVE the active cell. Any ideas ? It drives me crazy...:confused:
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
I got vertical connector... but not at the middle of the active cell ... any idea ? :(

Code:
l = (ActiveCell.Offset(0, 1).Left)
    r = (ActiveCell.Top + ActiveCell.Offset(3, 0).Top) / 2
    t = (ActiveCell.Top + ActiveCell.Offset(1, 0).Top) / 2
    Set con = ActiveSheet.Shapes.AddConnector(msoConnectorStraight, l, t, l, r)
        con.line.Weight = 1
        con.line.ForeColor.RGB = RGB(0, 0, 0)
 
Upvote 0
ok... hard to get a point of view today... anyway, I get a bottom vertical connector for an active cell

Code:
   l = (ActiveCell.Offset(0, -1).Left + ActiveCell.Offset(0, 2).Left) / 2
    r = (ActiveCell.Top + ActiveCell.Offset(8, 0).Top) / 2
    t = (ActiveCell.Top + ActiveCell.Offset(2, 0).Top) / 2
    Set con = ActiveSheet.Shapes.AddConnector(msoConnectorStraight, l, r, l, t)
        con.line.Weight = 1.5
        con.line.ForeColor.RGB = RGB(0, 0, 0)

but still don't know why the connector if for some active cells selected, at their middle and for others not, rather at 1/3 of the active cell
 
Upvote 0
any chance to get a reply ? I would like to know why the vertical connector is not at the exact centre for some cells, while it's the case for some other cells. ..maybe to change something in the code about the variable ''l''
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,217
Members
452,619
Latest member
Shiv1198

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