ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Initialize HorizontalAlignment from an integer value using VBA (https://www.excelbanter.com/excel-programming/347545-re-initialize-horizontalalignment-integer-value-using-vba.html)

Remy[_3_]

Initialize HorizontalAlignment from an integer value using VBA
 
Sub test()

Dim cell As Excel.Range

Set cell = Excel.Worksheets("Sheet1").Cells(1, 1)

cell.HorizontalAlignment = Val("2")

End Sub

Int() just converts a number to an integer, if you want to convert a
string, you need Val().

Cheers

Remy
www.collaboral.com



All times are GMT +1. The time now is 09:15 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com