Solved

VBA to set Cell Orientation

Posted on 2014-02-07
3
1,116 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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
HasData 9 36
excel pivot question 4 40
Hard coding time and date into Excel 2 30
Importing and Dropping Table in Access 11 22
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

930 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

13 Experts available now in Live!

Get 1:1 Help Now