vertical title in excel cells
I use the code, for example :
excelsheet.application.worksheets("myname').value="prod"
with excelsheet.application.worksheets("myname").range("A1")
.orientation=xlvertical
end with
and sometimes works : it gives p
r
o
d
and some others does nothing!!
I feel I need the value of the constant xlvertical, but don't know how to find it. Once I needed the value of xlup and you gave it to me : -4162
Furthermore what I really want is the result d
o
r
p
and the 4 lines nearer. Any help? Thanks
Re: vertical title in excel cells
Here is the value for the const. -
So your saying that you want to reverse the cell contents and make it verticle?
rotated text in left side of cell in excel sheets
The following code works O.K. : the texts in cells are rotated 90 degres as I wanted. But they appear at the righ(the end) of the cell and I want them at the left(the beggining of the cell) :
with hoja.application.worksheets("produccion").range("A1:J1)
.orientation=90
end with
I tried various codes including "alignment" in diferent contexts, but all failed!! Please, any help? Thanks.
Re: rotated text in left side of cell in excel sheets
What is the column formatted as? Text or numbers. Also, check you alignment formatting on the column.
rotated text in left side od cell in excel sheet
I want the rotated text in a row, namely, ("A1:J1") . The row is all text
Furthermore, I can do this in excel , directly by opening format, cells, alignment :90,alignment horizontal text: left, alignment vertical text: bottom. But, of course, I want to do it in a VB program.
Re: vertical title in excel cells
I fixed all your "New" threads as one thread. Please use the "Reply" button to reply to a posting.
What code from VB do you have already? Can you post it?
Re: vertical title in excel cells
The code I use is simply :
with hoja.application.worksheets("produccion").range("A1:J1")
.orientation=90
end with
The result is : the texts I had in cells A1 to J1, which were oriented horizontally, become vertical . This is O.K. Bue located at the right of each cell . I would like them at the left. Thanks for all !!
Re: vertical title in excel cells
This should do it.
VB Code:
With hoja.Application.Worksheets("produccion").Range("A1:J1")
.HorizontalAlignment = xlLeft
.Orientation = 90
.VerticalAlignment = xlBottom
.WrapText = False
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Re: vertical title in excel cells
Thanks. But I don't have the values of the constants involved in your code. Please,can you send them?
Re: vertical title in excel cells
You should have them if you added a reference to MS Excel xx.0 Object Library.
VB Code:
Const xlLeft = -4131
Const xlBottom = -4107
Const xlContext = -5002
Re: vertical title in excel cells
Many, many thanks. It worked !!
Re: vertical title in excel cells
Your welcome :thumb:
Ps, dont forget to Resolve your thread as a courtesy to other members so
they dont read the thread only to find its already solved. ;)
Instructions are in my signature. :)