Macro code to center pasted data in a column

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Using Excel 2003, I have to add data to a spreadsheet throughout the data by
pasting data from a query. Is the some code to center data in a column
and/or right or left justify as well? I am a novice macro coder so all help
is greatly appreciated.
 
Have you tried recording a macro while doing manually. Then clean up

sub centercol
Columns("E:F").horizontalAlignment = xlCenter
end sub

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 7/9/2007 by Donald B. Guillett
'

'
Columns("E:F").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
End Sub
 
Thanks - that's what I did - the only problem I had with centering the column
was that it was a shared workbook. Once I took that off, works great,
Thanks for the tips and help
 
Back
Top