PDA

View Full Version : How to use "align right" in VBA?



snoopies
08-12-2006, 07:24 PM
Hi all, I want to align right column (e.g column D), the following code doesn't work.. With Columns("D:D").Columns
.HorizontalAlignment = xlRight
End With Any suggestions? Thanks a lot!

Cyberdude
08-12-2006, 08:09 PM
Instead of xlRight try using xlHAlignRight.
No guarantees.

Cyberdude
08-12-2006, 08:33 PM
This should do it: insert ActiveSheet. following "With" so you will have:
With ActiveSheet.Columns("D:D").Columns
Also I don't think you need the ".Columns" at the end.

mdmackillop
08-12-2006, 08:39 PM
Columns(4).HorizontalAlignment = xlRight