+ Reply to Thread
Results 1 to 3 of 3

Searching through a non-contiguous range

  1. #1
    Registered User
    Join Date
    03-03-2016
    Location
    London, England
    MS-Off Ver
    2007
    Posts
    14

    Searching through a non-contiguous range

    I have a UserForm for updating details on a sheet by searching for a reference in a range and updating the cell to the right of that using offset. I'm using this method to elimate the dreaded human error factor.

    I found the below code down the back of the internet and have adapted it to suit my workbook. It uses a string (in TextBox_Reference) and searches in column R and stamps the value from Textbox_Date to the corresponding cell (next column over).

    I need to somehow adapt this so if it doesn't find the value in column R it checks V and then Z and then AD. In reality there will be many columns to check.

    Could someone please help me amend this so it searches through a non-contiguous range?
    Each column in the range will start from row 2 and end at the same "LastRow" which is defined earlier in the code.

    Many thanks in advance.

    Kerry.


    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Searching through a non-contiguous range

    Maybe:

    Please Login or Register  to view this content.

  3. #3
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Searching through a non-contiguous range

    Hi there,

    It's not easy to test this without access to your worksheet and UserForm, but try using the following code as a replacement for the code you've posted:

    Please Login or Register  to view this content.
    The highlighted values can be changed, deleted or added to as per your requirements.


    It's also likely that this statement can be simplified to:

    Please Login or Register  to view this content.

    Hope this helps - please let me know how you get on.

    Regards,

    Greg M

+ 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. excel vba range property non contiguous range
    By Ramo13541 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-02-2016, 08:23 PM
  2. [SOLVED] Using scripting dictionary to add contiguous group of items from non contiguous range
    By stnkynts in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-29-2014, 06:12 PM
  3. [SOLVED] How to sum non-contiguous columns applied as a formula on contiguous cells
    By figo12 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 10-09-2013, 01:07 PM
  4. [SOLVED] How to delete multiple contiguous (and/or) non-contiguous rows, in an excel table
    By jimmalk in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-03-2012, 05:48 AM
  5. Searching non consecutive or contiguous words
    By wvollbon in forum Excel General
    Replies: 0
    Last Post: 01-31-2012, 07:35 PM
  6. Contiguous "Range" from Non Contiguous Ranges
    By DonkeyOte in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 01-03-2011, 03:23 PM
  7. Copy and Paste an array (contiguous & non contiguous ranges)
    By Xrull in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-09-2010, 09:17 AM

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