Solved

VBA to set Cell Orientation

Posted on 2014-02-07
3
1,057 Views
Last Modified: 2014-02-07
I am trying to set the cell orientation of the first row of my worksheet to xlUpward but I cannot get it to work, can anyone help me accomplish this?

I've tried about 30 things and nothing is working. This is what I currently have in my code.

"... all of the usual Dim objects to open the spreadsheet etc...then"

    oWsh.Activate
    With oWsh
        .Range("1:1").Font.Bold = True <--this works
        .Range("1:1").Select
            With Selection
                .Orientation = xlUpward <--it breaks here
            End With
    End With
0
Comment
Question by:boukaka
3 Comments
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 500 total points
ID: 39842832
if you add to your references the Excel object library, that should work.

if you are using Late Binding, you have declare the value of  xlUpward

Const xlUpward = -4171

or just use
 .Orientation =-4171
0
 

Author Comment

by:boukaka
ID: 39842868
YOU ARE A LIFESAVER!!! Thank you so much.
0
 
LVL 30

Expert Comment

by:hnasr
ID: 39842869
Try:
oWsh.Activate
    With oWsh
        .Range("1:1").Font.Bold = True <--this works
        .Range("1:1").Orientation = xlUpward
    End With
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now