+ Reply to Thread
Results 1 to 3 of 3

Issue with Range involving discontiguous cells in a column

  1. #1
    Forum Contributor
    Join Date
    04-11-2012
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2010
    Posts
    225

    Issue with Range involving discontiguous cells in a column

    So I am trying to figure the best way to select all cells in column B in the workbook I'm opening beginning with cell B2 and down to the last filled cell in column B. The SetRng line of code I have commented out works great for the range B2 to B201. But what if I have cells beyond 201 or... what if only cells B2, B3 and B4 are filled? I had hoped that my second SetRng statement would be a bit more efficient but it produces an 'Object Required' error.



    Please Login or Register  to view this content.

  2. #2
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 2010, 2019
    Posts
    2,261

    Re: Issue with Range involving discontiguous cells in a column

    You cannot Select and assign as value on the same line of code. And there is no need to select anything anyway. Also, all cells must reference the correct worksheet. Change the line of code you marked "THIS DOES NOT WORK" to this and it should be fine...
    Please Login or Register  to view this content.

  3. #3
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    20,408

    Re: Issue with Range involving discontiguous cells in a column

    You need to qualify the Parent object for Cells/Range, otherwise it try to read it from ACTIVE sheet.
    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] IF function issue involving blank cells
    By brianb80 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-29-2019, 08:12 PM
  2. [SOLVED] Discontiguous Column Selection
    By jomili in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-19-2016, 10:09 AM
  3. [SOLVED] How do I get a function to use a discontiguous set of range data in XIRR?
    By armanschwarz in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-17-2013, 12:44 AM
  4. nesting issue involving percentages
    By statictwist in forum Excel General
    Replies: 6
    Last Post: 06-10-2010, 05:56 PM
  5. [SOLVED] Looping Thru Cells in a Discontiguous Range
    By Larry.LeBlanc@O in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-10-2008, 04:16 PM
  6. Is it possible to plot discontiguous cells?
    By Peter Bernadyne in forum Excel Charting & Pivots
    Replies: 8
    Last Post: 05-11-2006, 04:50 PM
  7. Is it possible to plot discontiguous cells?
    By Peter Bernadyne in forum Excel General
    Replies: 0
    Last Post: 05-09-2006, 05:32 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