# VBA Excel cell format not working



## Big Otis (Jul 23, 1999)

I am using vba code to format some cells in a spreadsheet. When trying to set the horizontal alignment, it just doesnt seem to work. No error is generated but the alignment is always Left.

The code doing this is in an Access2K module. Here is the piece i am trying to use:


```
With ExcelApp.ActiveCell
        .Font.COLOR = vbBlack
        .Font.Size = 10
        .Font.FontStyle = "Bold"
        .Font.name = "Arial"
        .HorizontalAlignment = xlCenter
        .VerticalAlignment = xlTop
        .WrapText = True
        .Orientation = 0
        .AddIndent = False
        .IndentLevel = 0
        .ShrinkToFit = False
        .MergeCells = False
        .Interior.COLOR = 10092543
    End With
```
Anything extraneous that i am missing?

TIA


----------



## AngryClip (Jun 14, 2002)

It looks ok ... mine works and mine is;
ActiveCell.Select
With Selection
.HorizontalAlignment = xlCenter
End With


----------



## Big Otis (Jul 23, 1999)

Thanks for the response. 

I have essentially the same code working in other places in the same spread sheet, i just have a few cells that it refuses to work in. i have already given up on this particular instance though. 

Moderator, please go ahead and mark this closed, i am giving up.

Thanks


----------



## AngryClip (Jun 14, 2002)

oh well


----------

