View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Remy[_3_] Remy[_3_] is offline
external usenet poster
 
Posts: 18
Default 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