C45P4R
New Member
- Joined
- Oct 15, 2014
- Messages
- 39
I just copied and pasted some old code and changed the references around so it did the same stuff on a different tab. For some reason, copy and paste has broken the code and it works until the new part.
It is currently not selecting the columns I specify, and is applying my formatting to everything. I realise .select is inefficient but I don't know enough to do it any other way.
It starts going wrong here, but only with the cell selections. It will run, but everything is centered and formatted as a date...
It is currently not selecting the columns I specify, and is applying my formatting to everything. I realise .select is inefficient but I don't know enough to do it any other way.
It starts going wrong here, but only with the cell selections. It will run, but everything is centered and formatted as a date...
Code:
'Data Formatting: Align these columns
Range("H:I,T:W,AB:AB").Select
With Selection
.HorizontalAlignment = xlCenter
End With
Range("A3").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
'Data formatting: Set these columns to the desired formats.
Range("J:K,S:S,X:AA").Select
Selection.NumberFormat = "_(* #,##0_);_(* (#,##0);_(* ""-""_);_(@_)"
Range("AC:AE").Select
Selection.NumberFormat = "mm/dd/yyyy"