Sign in to follow this  
Followers 0
dickep

Excel center column and row

3 posts in this topic

I know this has been asked and answered, but my search did not find anything.

So, I have an excel spreadsheet that I put data into using Autoit. However, I have changed the row height OK, but just cannot figure out how to center the data in the cell both vertically and horizontally.

Any help would be appreciated.

Thanks

E

Share this post


Link to post
Share on other sites



Use the HorizontalAlignment and VerticalAlignment properties:

$oExcel.Activesheet.Columns("A:F" ).HorizontalAlignment = 7
or use function _ExcelHorizontalAlignSet found in the Excel UDF.

The constants used by Excel can be found here.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

water, thank you. However the 7 was incorrect, should have been -4108 (or use $xlCenter variable out of Excel.au3).

You pointed me into the right direction.

Now to move to the next challenge.

E

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0