Solved

VBA to set Cell Orientation

Posted on 2014-02-07
3
1,238 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) 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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

626 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