Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I add an integer to an existing integer? Aaron Excel Worksheet Functions 3 December 17th 09 09:46 PM
Initialize macro Tom Jung Excel Programming 1 October 31st 05 04:04 AM
HorizontalAlignment Error in Excel 97 Werner[_35_] Excel Programming 2 August 5th 05 03:52 PM
Cannot set HorizontalAlignment Property of the Range Class Alan Excel Programming 10 December 10th 04 12:57 AM
Setting HorizontalAlignment with VBA Jo[_6_] Excel Programming 1 November 16th 04 02:55 AM


All times are GMT +1. The time now is 12:14 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"