+ Reply to Thread
Results 1 to 4 of 4

Problem with creating range with visible cells

  1. #1
    Registered User
    Join Date
    03-29-2013
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2007
    Posts
    2

    Problem with creating range with visible cells

    I am trying to create a range with visible cells after filtering based on a criteria. But, facing some wierd problem with setting correct range with visible cells. Here is the code. Can anyone help to resolve this?

    Please Login or Register  to view this content.
    Here,
    Please Login or Register  to view this content.
    returns correct values. For example, for a particular filtered criteria, if there are 6 rows, it returns 42 (6 rows * 7 columns).
    However,
    Please Login or Register  to view this content.
    always returns 1 (header row), though there are 6 rows. How can this be fixed?

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,434

    Re: Problem with creating range with visible cells

    You need to process areas if the range is not contiguous

    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    03-29-2013
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Problem with creating range with visible cells

    Andy,
    Thanks for quick reply. I am using this piece of code in vb.net & want to create the range of filtered cells & use it later. It is not just for reading the total rows. There must be a way to create correct range of visible cells & read it's values.

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,434

    Re: Problem with creating range with visible cells

    regardless of language you will need to use the areas object to get to each non contiguous area of the range.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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