+ Reply to Thread
Results 1 to 8 of 8

Help! - Range = Array when ranges is filtered is not working

  1. #1
    Registered User
    Join Date
    04-13-2012
    Location
    Tauranga, New Zealand
    MS-Off Ver
    Excel 2010
    Posts
    15

    Red face Help! - Range = Array when ranges is filtered is not working

    Hello, would really appreciate some help with this please.

    I have a large sheet of data in which I would to manipulate a range of data quickly.

    To do this I have been copying the range into an array, making the appropriate changes and then dumping the array back to the range.

    The reason I have been doing this instead of dealing with the range directly is this way is a lot quicker.

    However I have just come across a problem.

    For this post, if we can look at a sheet that has...

    Capture.PNG

    As you can see the range has a filter on it, if we select A2 and change the filter to everything apart from D and E, and the run the following code...

    Please Login or Register  to view this content.
    It loads the data into the array fine, and it manipulates the data fine, but when it drops the data back onto the sheet, the only information that is correct is in rows 3 to 5.

    It seems to work fine until it hits a hidden row, and then everything else equals only the first element of the array.

    I would really appreciate some assistance with this please.

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,610

    Re: Help! - Range = Array when ranges is filtered is not working

    Maybe:
    Range("B3:B9").specialcells(xlCellTypeVisible).Value
    Ben Van Johnson

  3. #3
    Registered User
    Join Date
    04-13-2012
    Location
    Tauranga, New Zealand
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Help! - Range = Array when ranges is filtered is not working

    No, still no luck.

    Thanks for the suggestion though.

  4. #4
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,610

    Re: Help! - Range = Array when ranges is filtered is not working

    Post a sample workbook.

  5. #5
    Registered User
    Join Date
    04-13-2012
    Location
    Tauranga, New Zealand
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Help! - Range = Array when ranges is filtered is not working

    Here you go, sorry.

    The workbook is designed so that you can right click on a cell in column C and it will toggle the value there. You can right click either a single cell or a selected range (if it is in Column C only).

    So if we right click on C7 to make a Y show for Cindy,
    Change the filter to exclude Fred from view,
    And then Select Range C1:C7 and right click in that range,

    This should toggle each cell in the selected range, but does not.

    Sample Issue.xlsm

    I hope I have made this clear.

    Thanks for checking this out for me

  6. #6
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Help! - Range = Array when ranges is filtered is not working

    Hi gsmcconville,
    Do not look at your file. If the filter is applied on the sheet, the values ​​are transferred to an array incorrectly, so try something like this
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    04-13-2012
    Location
    Tauranga, New Zealand
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Help! - Range = Array when ranges is filtered is not working

    Hi Nilem, the values are loading into the array fine, I have placed a watch on the array and confirm all the values are correct. It is just when dumping the array back to the spreadsheet that it all goes wrong.

  8. #8
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Help! - Range = Array when ranges is filtered is not working

    Hi gsmcconville,
    maybe something like
    Please Login or Register  to view this content.

+ 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. [SOLVED] Excel VBA - Issue in Naming Filtered Range on a Filtered List.
    By Vinod Krishna.C in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-06-2014, 01:17 PM
  2. [SOLVED] Add Auto Filtered Non Contigous range to Array
    By Foreverlearning in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-26-2012, 04:27 AM
  3. Working with various Ranges (Named Range) and Worsheet Events
    By aefavant in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-11-2010, 03:30 PM
  4. Replies: 5
    Last Post: 02-01-2006, 10:10 AM
  5. Question about working with range array
    By 39N 95W in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-18-2006, 07:55 PM

Tags for this Thread

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