Iain Mackintosh
Iain Mackintosh

Reputation: 1

vba format columns

I'trying to format columns on a newly created worksheet. I couldn't get selection and with statements to work, so I tried direct assignment and got the same problem (generic error 1004). Last code I tried was:

    Sheets("Survey Data").columns("A").NumberFormat = "0"
    Sheets("Survey Data").columns("A").VerticalAlignment = x1Bottom
    Sheets("Survey Data").columns("A").HorizontalAlignment = xlCenter
    Sheets("Survey Data").columns("A").ColumnWidth = 5

When checking output, the NumberFormat seems to have worked, but not the three following statements.

Upvotes: 0

Views: 2504

Answers (1)

Konstant
Konstant

Reputation: 2199

Try changing

Sheets("Survey Data").columns("A").VerticalAlignment = x1Bottom

to

Sheets("Survey Data").columns("A").VerticalAlignment = xlBottom

I see a "1" (One) instead of a "l" (L). It should be xlBottom and not x1Bottom

Upvotes: 2

Related Questions