Note that there are some explanatory texts on larger screens.

plurals
  1. POExcel's cell center shifted
    primarykey
    data
    text
    <p>I have been working on a math drill program for a bit now. I had asked a similar question to this previously but I wasn't getting any good help with it. So I decided to research the problem more thoroughly and found something interesting.</p> <p>Now before I begin, I just want to go over the preliminaries. Yes, I am using Microsoft Excel 2007. No, while this may work for you, it is not for me.</p> <p>Okay now that, that is taken care of:</p> <p>The problem I am having is when I have</p> <pre><code>ActiveCell.NumberFormat = "# ?/?" </code></pre> <p>in my my code it causes the excel's center line to be shifted to the left (that is the only way i know how to explain it).</p> <p>Meaning, if you have something right justified, it will look centered, if it is centered it will be almost left justified and there is very little difference between left and center justified.</p> <p>if i have</p> <pre><code>ActiveCell.NumberFormat = "?/?" </code></pre> <p>then there is none of the above problems.</p> <p>The entire code of this section is as follows:</p> <pre><code>Sub test() Sheets("sheet1").Select Range("a1").Select For i = 1 To 10 ActiveCell.NumberFormat = "# ?/?" With ActiveCell .Locked = False .HorizontalAlignment = xlCenter .VerticalAlignment = xlBottom End With ActiveCell.Value = 33 ActiveCell.Offset(0, 1).Select Next i End Sub </code></pre> <p>Any suggestion or reason for why this is happening would be greatly appreciated. Ideally the user should be able to see a mixed number.</p> <p>Further information, if I change each cell by hand to fraction then it works fine. it is only when excel does it.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload