+ Reply to Thread
Results 1 to 6 of 6

Set two loop values as a range.

  1. #1
    Registered User
    Join Date
    07-30-2015
    Location
    Nashville,TN
    MS-Off Ver
    2010
    Posts
    6

    Set two loop values as a range.

    I have a list of cell ID's that have a value set as 1 if it starts with a particular letter, then 2 if it doesn't.
    What I need in my module is to run a 'loop until' that will find the first "2" in row "D:D" then set that as the cell1 in a range. Then, 'loop until' it finds the next "1" and offset (-1) and set that as cell2 in a range.
    After that range is set I would run my code based on the range.
    Last edited by bsladecamacho; 07-30-2015 at 02:21 PM.

  2. #2
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Set two loop values as a range.

    Perhaps:

    Please Login or Register  to view this content.
    Make Mom proud: Add to my reputation if I helped out!

    Make the Moderators happy: Mark the Thread as Solved if your question was answered!

  3. #3
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Set two loop values as a range.

    Hi bsladecamacho and welcome to the forum,

    Here is some code that may do what you need. It is hard to understand exactly what you want but see if this helps.
    Please Login or Register  to view this content.
    Attached Files Attached Files
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

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

    Re: Set two loop values as a range.

    Another:

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    07-30-2015
    Location
    Nashville,TN
    MS-Off Ver
    2010
    Posts
    6

    Re: Set two loop values as a range.

    To daffodil11,
    The problem with this is that it is searching for the 2 in the wrong column. I already have a column with the 1's and 2's. What needs to happen is it look at first 2 select the offset (0,-1) and set that as the first range

  6. #6
    Registered User
    Join Date
    07-30-2015
    Location
    Nashville,TN
    MS-Off Ver
    2010
    Posts
    6

    Re: Set two loop values as a range.

    Quote Originally Posted by MarvinP View Post
    Hi bsladecamacho and welcome to the forum,

    Here is some code that may do what you need. It is hard to understand exactly what you want but see if this helps.
    Please Login or Register  to view this content.
    I made one tiny change. On the Dtop it is to select the cell above then first "2" found
    Please Login or Register  to view this content.
    Great help! Thanks for the help. It is greatly appreciated!

+ 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. Loop through each folder copy values from range in file1 to named range in file2
    By dafella in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-16-2015, 05:19 PM
  2. [SOLVED] Macro to Loop through range, change values
    By Student1990 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-21-2014, 12:43 PM
  3. VBA check values from range with loop
    By Tosters in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 12-11-2013, 06:15 PM
  4. Count the values between range and loop
    By Raviprasad.k in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-21-2012, 09:42 AM
  5. Declare a FOR LOOP with a range but NOT these values.
    By clemsoncooz in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-19-2012, 09:19 PM
  6. Macro Loop to Extract Specific Values and Min/Max Values From Column/Rows Range
    By ExcelQuestFL in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 12-19-2010, 09:19 AM
  7. Need to find specific values in range using loop
    By frk1980 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-10-2005, 10:52 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