VBA - resizing single or multiple columns with VBA in Excel to fit specified area in PowerPoint

excelstarter1

Board Regular
Joined
Jul 20, 2017
Messages
81
Hey guys,

I really get a headache with the resizing of single or multiple colums with VBA in Excel. I already read a lot about how Excel determines sizes and how one could cope with the sizing issues (e.g. https://support.microsoft.com/en-us...-of-how-column-widths-are-determined-in-excel or Excel VBA Column Width: Step-by-Step Guide and 8 Code Examples).

However, I just don't get it. The problem is with the use of tables (created in Excel) in a PowerPoint presentation.

For example, I want to create a table in Excel which I want to use in a PPT presentation. The table should have the exact size of 13.50 cm in PowerPoint (not 13.52 or 13.48, but 13,5cm).

Lets say I want to create a cell/column in Excel with VBA that has the size equivalent in PowerPoint of 13.50 cm. In order to do that I would resize the colum in Excel to 72.14 (510 Pixel). The normal style of my workbook is Arial 9. This gives me 13.52 cm (copy and past a picture) in PowerPoint (so not even the 13.50 cm which I want). If I change it to 72.00 (509 Pixel) I end up with 13.48 cm in PowerPoint. Strange, I just cannot get the desired 13.50 cm. Why?

Now if I want two columns I would assume that each column should have the width of 36.07 (half of 72.14). However, it needs to be 35.71 each in order to sum up to a total of 13.52 cm in PowerPoint. With regard to pixel it his half, i.e. 255 Pixel. Just why?? I don't get it. I resize charts by using e.g.:
Code:
Selection.ColumnWidth = 10
Is this the wrong approach? How do I have to resize charts in order to get the desired size equivalent I want in PowerPoint?

Thanks in advance guys! Hope you can shed some light on this confusing topic.

Regards
 
Last edited:

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Hey guys, sorry to bother you again, but unfortunately I could not find a feasible approach in the meantime.
Could anyone please help? Thanks in advance!!
 
Upvote 0

Forum statistics

Threads
1,223,898
Messages
6,175,274
Members
452,628
Latest member
dd2

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