Note that there are some explanatory texts on larger screens.

plurals
  1. POBug in excel when using values property with filtered list
    primarykey
    data
    text
    <p>I've run into something I'm guessing is a nasty bug in Excel, but not sure.</p> <p>Strangely enough, I've never seen this before, despite 10 years developing in VBA for Excel. Works the same way in Excel 2010 and 2013 for PC.</p> <p>How to reproduce:</p> <ol> <li>New Workbook.</li> <li>Add a couple of column headers (Column 1-6) in cells a1:f1</li> <li>Add a few values (at least 2 different values) in the first column ("A" or "B") in cells a2:a8</li> <li>Add a filter to row 1 and select an item from the filter in Col A</li> <li>Hide column C</li> <li><p>Run the following macro:</p> <pre><code>Public Sub test() Dim rng As Range Dim v As Variant Dim i As Long i = 1 ReDim v(1 To i, 1 To 6) v(1, 1) = "x" v(1, 2) = "x1" v(1, 3) = "x2" v(1, 4) = "x3" v(1, 5) = "x4" v(1, 6) = "x5" Set rng = Sheet1.Range("A9:F9") If i = 2 Then v(2, 1) = "y" v(2, 2) = "y1" v(2, 3) = "y2" v(2, 4) = "y3" v(2, 5) = "y4" v(2, 6) = "y5" Set rng = Sheet1.Range("A9:F10") End If rng.Value = v End Sub </code></pre></li> </ol> <p>What now happens is the following, depending on the value of i.</p> <p>i=1:</p> <pre><code>A9="x" B9="x1" C9=unchanged D9:F9="x" </code></pre> <p>i=2:</p> <pre><code>A9="x" B9="x1" C9=unchanged D9="x" E9="x3" F9="#VALUE" </code></pre> <p>(row 10 is then similar to 9 but with "y" instead)</p> <p>i=1 at least seems to repeat the first value after the first hidden column. For i=2 I have no idea what it's doing.</p> <p>From my point of view this looks <strong><em>incredibly</em></strong> buggy.</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.
 

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