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

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.

Forum statistics

Threads
1,214,985
Messages
6,122,606
Members
449,089
Latest member
Motoracer88

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