简体   繁体   中英

Excel - Finding point location of a cell

In Excel 2013, I am programmatically adding a chart. To do so, I need to specify WHERE the chart is located. Specifically top, left, height and width. All these coordinates are points, not cell addresses. For example, the default height of a cell if 15 points. I know the cell address where I want the Graph to be located. How do I convert a cell address to a point? There has to be a better way than just iterating through every previous row/column and adding their height/width...

For example, Cell 'F7' might be 120 points left, and have a top point location of 90.

If it helps any, the syntax to add the chart is...

expression.AddChart2(Style,XlChartType,Left,Top,Width,Height,NewLayout)

Try this:

    X = Range("N4").Left
    Y = Range("N4").Top

I don't have anything to test it on so not sure it works.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM