Had you "tried" to record a macro, this is what you would have gotten. Then,
just clean it up as shown below it.
Sub Macro1()
'
' Macro1 Macro
' Macro recorded 10/16/2007 by Donald B. Guillett
'
'
Rows("1:1").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
sub centerrowtext()'cleaned up
Rows("1:1").HorizontalAlignment = xlCenter
end sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(E-Mail Removed)
"AccessHelp" <(E-Mail Removed)> wrote in message
news:883A9928-984D-4D5C-8E2C-(E-Mail Removed)...
> Thanks for your response. No, I didn't record the macro. I wrote the
> code
> from scratch, and this line item is just a portion of my entire code. One
> of
> the challenges that I have is I am still new to Excel syntax.
>
> Thanks.
>
> "Don Guillett" wrote:
>
>> Did you try recording a macro while doing it manually
>>
>> --
>> Don Guillett
>> Microsoft MVP Excel
>> SalesAid Software
>> (E-Mail Removed)
>> "AccessHelp" <(E-Mail Removed)> wrote in message
>> news:BA6CC3AA-2C12-40D8-A725-(E-Mail Removed)...
>> >I have values in Cells A1, B1 and C1 in a new sheet. How can I align
>> >them
>> >to
>> > center? I have tried the following:
>> >
>> > NewSheet.Rows(1).align msoAlignCenter, true
>> >
>> > Thanks.
>>
>>