VBA Auto Center Worksheet Contents

Bench

Board Regular
Joined
Aug 27, 2009
Messages
134
Hi,

Just wondering if there is a way to center a worksheets contents, for example i have a table that covers B2:F9 so when it prints off it shows as you would expect in the top left corner.

Obviously you can drag the borders and guestimate when you have the table in the center of the worksheet, is there a more accurate way to do this? or some script that could do this. i guess it would involve selecting a range and then doing some kind of autofit....

To clarify i would want the table to show bang in the middle, so equal distance from top and bottom AND equal distance from left border and right border.

Any ideas?

Thanks

Ben
 
Last edited:

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
In Page Setup on the Margins tab there are checkboxes to Center on page Horizontally and Vertically.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,151,978
Messages
5,767,419
Members
425,411
Latest member
sarmientojayexce03

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
Top