+ Reply to Thread
Results 1 to 2 of 2

Range Compare, For Each Loops, Nested IF Statements

  1. #1
    Registered User
    Join Date
    03-17-2020
    Location
    Earth
    MS-Off Ver
    Office 365
    Posts
    2

    Range Compare, For Each Loops, Nested IF Statements

    Looking for assistance with the following:

    Goal:

    Compare cells in 2 defined ranges (same size) one by one. If they are the same then move on to the next set of cells. If not:
    Input an integer (between 1 to 2000) in a corresponding cell within a 3rd range (same size as the other 2). Run this in a For loop until the cells in the first 2 ranges equal each other.
    Once achieved, then move on to the next set of cells and so forth.
    The code I've written up so far is outlined below but its not producing the right results. From what I can tell, the hCell value loops while the rest don't which is putting the If comparison conditions off...

    Thank you for any help with this!


    Please Login or Register  to view this content.
    Last edited by Housewins; 03-12-2021 at 09:11 PM.

  2. #2
    Registered User
    Join Date
    03-17-2020
    Location
    Earth
    MS-Off Ver
    Office 365
    Posts
    2

    Re: Range Compare, For Each Loops, Nested IF Statements

    I actually ended up finding a way to solve my issue by referencing the answer outlined in the link below. Just wanted to leave this here in case anyone else comes across the same problem I came across.

    [link] stackoverflow.com/questions/53100651/looping-through-two-cell-ranges-of-same-length-in-vba-given-range-object [/link]

    The revised code is also outlined below for reference.

    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] Modify the first nonempty cell (Using INDEX?) in a range based on nested IF statements
    By excel_novice2019 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 01-25-2019, 02:28 PM
  2. VBA speed performance issues with nested loops during import to table range
    By ggwp in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-29-2016, 09:16 AM
  3. [SOLVED] Nested For Each In Range Next Loops
    By MattyG1406 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 04-07-2015, 05:18 PM
  4. Nested IF statements with a range of cells
    By rteeling35 in forum Excel Charting & Pivots
    Replies: 4
    Last Post: 01-08-2013, 05:52 PM
  5. Rounding values to specific range or increased nested if statements??
    By 311guy in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-23-2011, 12:58 PM
  6. If statements in loops
    By Marie1uk in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-28-2006, 08:28 PM
  7. Replies: 2
    Last Post: 10-07-2006, 09:23 AM

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