PDA

View Full Version : Solved: Columns Alighnment



tqm1
06-20-2007, 06:10 AM
Dear Experts

For columns alignment, I use following procedure
But all columns alighnment appears as CENTER ALIGHMENT
May third part of the codes applies to whole columns
Please modify


'columns alignment Left
Sheets("rpt_daily").Range("D:D,K:K").Select

With Selection
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlBottom
End With

'columns alignment RIGHT
Sheets("rpt_daily").Range("G:G,H:H,I:I").Select

With Selection
.HorizontalAlignment = xlRight
.VerticalAlignment = xlBottom
End With

'columns alignment center
Sheets("rpt_daily").Range("A:A,B:B,C:C,E:E,J:J").Select

With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
End With

mvidas
06-20-2007, 06:17 AM
Hi,

There is no need to select those columns, using them in the With block should suffice:'columns alignment Left
With Sheets("rpt_daily").Range("D:D,K:K")
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlBottom
End With

'columns alignment RIGHT
With Sheets("rpt_daily").Range("G:I")
.HorizontalAlignment = xlRight
.VerticalAlignment = xlBottom
End With

'columns alignment center
With Sheets("rpt_daily").Range("A:C,E:E,J:J")
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
End With