+ Reply to Thread
Results 1 to 4 of 4

SetSourceData with noncontiguous ranges

  1. #1
    Registered User
    Join Date
    12-27-2015
    Location
    Iowa, USA
    MS-Off Ver
    2010
    Posts
    83

    SetSourceData with noncontiguous ranges

    Seems this is a minor syntax issue.

    First example works fine.

    HTML Code: 
    Second example technically works but not what I need.

    HTML Code: 
    Note 3 columns considered, however, I don't want column GK. Also, I don't want row 200. So I'm trying this....

    HTML Code: 
    ...which appears to plot fine, but looking at the selected data reveals 2 series, one additional for column K. I found something on "union" for noncontiguous ranges and have tried substituting it for "Range" but the syntax is incorrect and/or incomplete. Hopefully someone sees the issue and can point me to the solution.

    Lewis

  2. #2
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent SAC
    Posts
    8,885

    Re: SetSourceData with noncontiguous ranges

    To exclude GK the syntax would be:

    Please Login or Register  to view this content.
    Rory

  3. #3
    Registered User
    Join Date
    12-27-2015
    Location
    Iowa, USA
    MS-Off Ver
    2010
    Posts
    83

    Re: SetSourceData with noncontiguous ranges

    Thank you Rory. I was able to get the solution, which was the Union method. I'd just neglected identifying the object with it. Here's what I found worked...
    HTML Code: 
    I was probably using Union incorrectly in the first place. Still, I'm looking at your syntax and notice an additional comma in the second term. Is that what breaks the range apart? Your method seems like a little less work. Your help is always appreciated. Thank you.

  4. #4
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent SAC
    Posts
    8,885

    Re: SetSourceData with noncontiguous ranges

    Let's say lr is calculated as 100. My syntax resolves to:

    Please Login or Register  to view this content.
    which is one argument passed to the Range property (the address of the discontiguous range). Your original would resolve to:

    Please Login or Register  to view this content.
    which is two arguments passed, since the comma is not inside the quotes. When you pass two arguments to range, you're passing a start range and an end range, and everything in between is included. It's the same as the difference between:

    Please Login or Register  to view this content.
    which is just two cells, and:

    Please Login or Register  to view this content.
    which is actually equivalent to:

    Please Login or Register  to view this content.
    Make sense?

+ 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. SetSourceData Does not Set Consistently
    By Mordred in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 10-01-2011, 10:00 AM
  2. Highlight noncontiguous ranges of cells
    By TrafficGuy in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 02-01-2011, 06:57 PM
  3. SetSourceData Chart
    By vismbr in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-22-2009, 07:54 AM
  4. Printing noncontiguous ranges on 1 Page
    By JARLATH1000 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-12-2008, 10:42 AM
  5. Ranges & SetSourceData
    By ckiraly in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-25-2008, 07:55 PM
  6. Noncontiguous Dynamic Ranges
    By jasoncw in forum Excel General
    Replies: 1
    Last Post: 02-07-2007, 03:20 PM
  7. [SOLVED] Noncontiguous ranges printed on one page????
    By ajchula in forum Excel General
    Replies: 5
    Last Post: 10-24-2005, 07:05 PM
  8. [SOLVED] Noncontiguous Cells or Ranges in a Formula?
    By meverly9 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-30-2005, 08:05 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