Problem with top property in a range variable

billritz

New Member
Joined
Aug 20, 2012
Messages
23
I'm using shapes.addline method in a sub to draw a line, passing in 2 ranges rFrom and rThru, and then using .top and .left on the ranges to supply the four points for the line. Seems pretty straightforward, but the line sometimes comes out at an angle when I've passed in ranges on the same row. In the immediate window I found out why. When I refer to the variable rThru it contains an incorrect top, though the address is correct:
? rFrom.address & " " & rThru.address
$AU$128 $BJ$128
? rFrom.top & " " & rThru.top
1259.25 1235.25
? range("BJ128").Top
1259.25
I can work around it in this instance because I need a flat line, so I can change the sub to use rFrom for both points, but if anybody knows what could cause this, please let me know.
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.

Forum statistics

Threads
1,215,217
Messages
6,123,673
Members
449,116
Latest member
HypnoFant

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