UnsolvedCoding
Technical User
I can't figure this one out. I have three different sets of code that is simply to center text in cells. When either of the first two are run in the sub or the immediate window it doesn't work and returns null.
But when I recorded a macro and ran that code (below) it worked fine. Why?
It has taken me a while to make sense of what I hear at work involving computers. There is much talk of bugs and questions about Raid.
Therefore I have come to the logical conclusion that the only way to have a properly functioning computer is to regularly spray it with Raid bug killer.
Code:
?ThisWorkbook.Sheets("Grouping").Cells.HorizontalAlignment = xlCenter
Null
?Cells.HorizontalAlignment = xlCenter
Null
But when I recorded a macro and ran that code (below) it worked fine. Why?
Code:
Sub Macro1()
'
' Macro1 Macro
'
'
Cells.Select
With Selection
.HorizontalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Range("A1").Select
End Sub
It has taken me a while to make sense of what I hear at work involving computers. There is much talk of bugs and questions about Raid.
Therefore I have come to the logical conclusion that the only way to have a properly functioning computer is to regularly spray it with Raid bug killer.