+ Reply to Thread
Results 1 to 3 of 3

Nested loop problem

  1. #1
    Registered User
    Join Date
    12-13-2014
    Location
    Boston, MA
    MS-Off Ver
    MS Office 2013
    Posts
    53

    Nested loop problem

    Hey guys,

    This should be a relatively easy fix. I'm looking to loop through an arbitrary number of columns and rows in a worksheet (in this example n=20) and color cells if the cells value matches any values in a one-dimensional array. The ultimate goal of this macro will be to color code these cells to create a heat map linked to the frequency of occurrences of the given events stored in the array. The current code loops through the columns and rows but is highlighting everything in red when it should be only highlighting those cells with values that match the values stored in the array. Thanks for the help in advance!

    Sample array:

    array.JPG

    Sample heat map:

    floor.JPG

    Please Login or Register  to view this content.

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,426

    Re: Nested loop problem

    You need to change this line in your macro:

    Please Login or Register  to view this content.
    so that you are looking for an exact match.

    Hope this helps.

    Pete

  3. #3
    Registered User
    Join Date
    12-13-2014
    Location
    Boston, MA
    MS-Off Ver
    MS Office 2013
    Posts
    53

    Re: Nested loop problem

    Could someone explain how I should go about coding the array and cells with an exact match?

+ 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. Problem with vba copy find nested loop
    By Anna_P in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-20-2014, 09:08 AM
  2. nested loop problem
    By mcousin in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-07-2014, 02:39 PM
  3. Find function in nested loop breaking down - not on first time through loop
    By adamstarr12 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-07-2014, 04:59 PM
  4. [SOLVED] Having problem with a nested FOR loop
    By GIS2013 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-03-2014, 04:39 AM
  5. Nested Loop problem/Algorithm
    By Asad74 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-11-2012, 09:36 PM
  6. Next without For error in nested loop - Escaping a Nested Loop?
    By BeneRich in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-10-2012, 06:38 PM
  7. For each loop nested; getting stuck on one cell in first iteration of nested loop
    By Excel_vba in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-22-2009, 11:54 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