Hi I'm currently using a macro that autoformats tables for me and aligns all cells centrally except for the ones in the first selected column.
I was wondering if there was a way to tweak this so that the 1st selected column is aligned left only if it contains text and not if it contains a number
Here's the code:
Sub Test_align_left()
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Columns(1).Select
On Error Resume Next
With Selection
.SpecialCells(xlCellTypeConstants, xlTextValues).HorizontalAlignment = xlLeft
.SpecialCells(xlCellTypeFormulas, xlTextValues).HorizontalAlignment = xlLeft
End With
End Sub
Thanks in advance,
Thomas