+ Reply to Thread
Results 1 to 3 of 3

Can you set .splitrow (correctly) on an autofiltered sheet?

  1. #1
    Valued Forum Contributor
    Join Date
    11-15-2010
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2003
    Posts
    538

    Can you set .splitrow (correctly) on an autofiltered sheet?

    Run this code and watch the debug window! Why can't I set .splitrow to 3? It insists on setting it to 8. (Note, the code shows that that value is already 3. Then I set it to 3 (set it to the value that it already is), yet it insists on setting it to 8.)

    I tested XL03; if your results vary with another version, please let me know that instead.
    Please Login or Register  to view this content.
    If you set the .SplitRow to less than 4, it's fine. If you set it to anything in (4 through 9) it simply sets the value to 8. If you set it to anything in (10 through highest visible row) it sets it to what you tell it. If you set it higher than the highest visible row number it sets it to the highest visible row number. All of these makes sense except when you try to set it to something in (4 through 9).

    Here is my sad, demented theory: for the incorrect calculation Excel calculates .SplitRow by taking the total number of rows, minus the frozen number of rows, plus 1. Unfortunately, when a filter is on (or perhaps just when rows are hidden?), that causes a distorted calculation.

    If indeed that or a different bug is in play, then I suppose that my workaround is to
    save off .scrollrow and each .pane's .scrollrow;
    walk through the .count of activesheet.autofilter.filters() and save a boolean of which ones are on;
    turn them off;
    do my thing with .splitRow's and .split and .freezepanes;
    turn the filters back on;
    restore .scrollrow and each .pane's .scrollrow.

    Is that what I need to do?

    By the way, I also tested setting .SplitRow with .FreezePanes and .Split both set to false, and it still sets it to 8, just as it does when .Split is True (and by the way, .Split changes to True when you set .SplitRow nonzero - which I hope helps at least one of us avoid some confused time wasting from not realizing that ).
    Last edited by Oppressed1; 08-22-2017 at 02:17 PM. Reason: grammatical fix, paragraph 2
    Chip, if you can read this, you're STILL making the world a better place with your immeasurably valuable gifts. Every week, you continue to help me (and untold numbers of others) tremendously. Practically no alternative outlets can match your effectiveness, even over the vast number of topics you demystify and empower usage of. You were, and still are, amazing.

  2. #2
    Valued Forum Contributor
    Join Date
    11-15-2010
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2003
    Posts
    538

    Re: Can you set .splitrow (correctly) on an autofiltered sheet?

    Ha. Instead of
    ActiveWindow.SplitRow = 3
    make that
    ActiveWindow.SplitRow = ActiveWindow.SplitRow
    to be truly amused or upset. That command also barbeques activewindow.visibleRange.row and activewindow.scrollRow. Try changing
    Debug.Print "before: "; ActiveWindow.SplitRow
    to
    Debug.Print "before: "; ActiveWindow.SplitRow,activewindow.visibleRange.row,activewindow.scrollRow
    and change the "after" also. Brace for weirdness.

    Isn't that more than odd?

  3. #3
    Valued Forum Contributor
    Join Date
    11-15-2010
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2003
    Posts
    538

    Re: Can you set .splitrow (correctly) on an autofiltered sheet?

    Additional question in case I have .scroll and .visibleRange gurus reading this: Are activewindow.visibleRange.row and activewindow.scrollRow strictly identical? ( and activewindow.visibleRange.column and activewindow.scrollcolumn ) Would it be redundant to manage one if you're already managing the other?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Peculiar .splitrow value while filtered
    By Oppressed1 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-19-2016, 05:29 AM
  2. 10% & 50% data of autofiltered visible data and move it to next sheet
    By prabhuduraraj09 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-11-2014, 11:07 PM
  3. Replies: 0
    Last Post: 04-13-2011, 05:30 PM
  4. VBA Code on AutoFiltered Sheet
    By ron2k_1 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-24-2010, 02:03 PM
  5. comments at end of sheet are not printing correctly
    By TreebeardEnt in forum Excel General
    Replies: 0
    Last Post: 06-06-2006, 07:25 PM
  6. [SOLVED] spread sheet not printing correctly
    By Beebs in forum Excel General
    Replies: 4
    Last Post: 09-21-2005, 09:05 PM
  7. can I export just the autofiltered data into own sheet?
    By kst82276 in forum Excel General
    Replies: 1
    Last Post: 05-13-2005, 01:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1