The below code selects the sheet but fails to align the cells to center:
wb.Sheets(1).Columns("A:L").Select
With Selection
    .VerticalAlignment = xlCenter
End With
wb.Sheets(1).Activate
wb.Sheets(1).Columns("A:L").Select
With Selection
  .VerticalAlignment = xlCenter
End With 
Selects the entire sheet but it's not changing the vertical alignment to center.
wb.Sheets(1).Columns("A:L").VerticalAlignment = xlCenter
Does nothing.
I don't want HorizontalAlignment :)
I found out the column has VerticalAlignment set to xlCenter but the Cells underneath the column do not have VerticalAlignment set to xlCenter.
Don't Select and don't work with Selection without a reason. That's Recorder's stuff.  It is longer to read, slower to execute, and prone to error.
wb.Sheets(1).Columns("A:L").VerticalAlignment = xlCenter  is much better.
If you need to do several things with the same range, then use With
with wb.Sheets(1).Columns("A:L")
      .VerticalAlignment = xlCenter
      .somethingElse
End with
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With