I'm currently working on a project in which I'm creating some excel reports that are built using Visual Basic. I would like to merge some of the cells in code, just to make the report look better. Does Excel have a built in VB function to merge a range of cells together? Also, is there any sort of built in function to change the zoom of a page automatically after creating a new worksheet object? My code automatically creates new worksheets as needed, and I would like them to be at a zoom level of 75% by default. Any help on either of these problems would be greatly appreciated!
[EDIT] Just figured out the cell merging, but the worksheet zooming is still not coming to me.
Sometimes the easiest way to get a command is to use the Macro Record function. Find it in 'Tools>Macro>Record...'
After you record an action you can stop the record and look at the results. Recording usually gives more cluttered code than you want but you can modifiy it from there to make it more concise. Use the record to 'This Workbook' or you'll have multiple workbooks generated.
Here's the zoom function
ActiveWindow.Zoom = 77
And the Horizontal Alignment. Keep in mind you will need to have a selection made or use a range statement with the HorizontalAlignment function like I'm showing here.