Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 887
  • Last Modified:

PointsToCentimeters VBA

Dear Experts:

I would like to retrieve the width and height of the first chart in a MsgBox ...
    W = ActiveSheet.ChartObjects(1).Width
    H = ActiveSheet.ChartObjects(1).Height

The measurements are regrettably displayed in Points, but I would like to show the measurements in centimeters rounded to two decimal places after the decimal point.
How is this achieved?

Help is much appreciated, thank you very much in advance,

Regards, Andreas
0
AndreasHermle
Asked:
AndreasHermle
1 Solution
 
Rory ArchibaldCommented:
application.round(ActiveSheet.ChartObjects(1).Width / application.CentimetersToPoints(1), 2)

Open in new window

and similarly for height.
0
 
AndreasHermleAuthor Commented:
Great. This did the trick. Thank you very much for your professional support. Regards, Andreas
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now