PDA

View Full Version : Solved: Alignment of text in cells



AmardeepD
02-20-2008, 03:17 AM
Ok so I am trying to get my code to change the appearance of text in cells. I have managed to get it to change the font to bold but i cant seem to get it to change the alignment. For bold/unbold the code is

Worksheets("Sheet1").Range("A51").Font.Bold= 'True or false


However i cant seem to figure out an equivalent for aligning the text. Its a stupidly simple problem and probs wont take 5 seconds for someone who knows how... Ignorance is NOT bliss! lol

Ago
02-20-2008, 04:18 AM
http://msdn2.microsoft.com/en-us/library/aa174756(office.11).aspx

powerd by google

AmardeepD
02-20-2008, 04:28 AM
ok so i used



Worksheets("Sheet1").Range("A51").Alignment= msoTextEffectAlignmentRight


came up with object does not support this object or method :s

Ago
02-20-2008, 04:30 AM
EDIT: ohh.. you posted before i did, LOL

couldnt get that one to work but i found another way.

Range("A" & 1).HorizontalAlignment = xlCenter , xlLeft , xlRight

AmardeepD
02-20-2008, 04:52 AM
Thanks that did it :wizard: