+ Reply to Thread
Results 1 to 4 of 4

Exclude certain cells

  1. #1
    Registered User
    Join Date
    01-08-2016
    Location
    Malmö, Sweden
    MS-Off Ver
    2010
    Posts
    7

    Exclude certain cells

    I have tried to find a solution to exclude certain cells in a range all over the place but I still haven't found what I am looking for. Maybe someone here can help me?

    The point is to exclude C20:C21, C33:C34 etc from the fillrange below (C9:C122) and I guess there is a very simple solution for the problem?

    Please Login or Register  to view this content.
    Another problem I have is how to include several sheets into this?
    Please Login or Register  to view this content.
    I want to write it like this, but this isn't working:
    Please Login or Register  to view this content.
    Any ideas?

    Thanks in advance!
    Last edited by 6StringJazzer; 01-21-2016 at 08:20 AM.

  2. #2
    Forum Contributor
    Join Date
    12-05-2015
    Location
    Akron, OH
    MS-Off Ver
    15.0
    Posts
    424

    Re: Exclude certain cells

    First of all, to take care of different worksheets, I would either loop over all worksheets or if you have just a few, define just a few worksheets as such (assuming they're in the same workbook as the code)

    You can loop over all worksheets if you declare a WS variable (Dim WS As Worksheet) with the following For -- Each structure:
    Please Login or Register  to view this content.
    Declaring Worksheets individually:
    Please Login or Register  to view this content.
    Then, to exclude certain ranges, I would use the Union function. Something like:
    Please Login or Register  to view this content.
    Remember, when you need to access fillRange (avoid .Copy/.Select/.Paste methods), you need to account for areas within the fillRange object because If you, say copy that range over to WS_MB2 in column 1, you'll need to loop over areas with a structure similar to:

    Please Login or Register  to view this content.
    Last edited by joe31623; 01-21-2016 at 08:26 AM.
    <---If my answer helped, please click *

  3. #3
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,852

    Re: Exclude certain cells

    Moderator's note: Please take the time to review our rules. There aren't many, and they are all important. Rule #3 requires code tags. I have added them for you this time because you are a new member. --6StringJazzer

    joe31623, please do not post to a thread with a rule violation, even if a Moderator has not flagged that violation.

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

  4. #4
    Forum Contributor
    Join Date
    12-05-2015
    Location
    Akron, OH
    MS-Off Ver
    15.0
    Posts
    424

    Re: Exclude certain cells

    6String: No problem; I apologize.

+ 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. Add EXCLUDE Option in table to Exclude from Solver
    By lbofbb in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-17-2015, 09:05 AM
  2. sum a range of cells but exclude the cells that are strings
    By postdirector in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-10-2013, 05:55 PM
  3. [SOLVED] Count number of cells that contain text but exclude cells that contain quotation marks
    By Cantyman in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-22-2012, 03:57 PM
  4. Exclude Blank cells when matching against other cells.
    By Neil07979 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-05-2008, 09:28 AM
  5. Need to exclude certain cells in a range
    By Bob Smith in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-05-2006, 12:30 PM
  6. [SOLVED] exclude cells with certain criteria
    By Bram in forum Excel General
    Replies: 2
    Last Post: 10-10-2005, 02:05 PM
  7. Replies: 2
    Last Post: 09-24-2005, 08:05 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