+ Reply to Thread
Results 1 to 2 of 2

Fastest Method to Lookup Value in Named Range and Return Cell Background Color

  1. #1
    Registered User
    Join Date
    08-08-2020
    Location
    Boston
    MS-Off Ver
    2019
    Posts
    33

    Fastest Method to Lookup Value in Named Range and Return Cell Background Color

    Hi all.

    I think the title of this thread says it all. I'm still new enough to vba that I'm understand that there are different methods to search spreadsheet data and or ranges, but I'm not sure what the fastest method is to search through named ranges in sheets.

    In "sheet1", I have a range of times that are next to to-do items in a list (scheduled times to perform tasks).
    Those time entry cells have cell validation for a drop down list of times, referencing the "hourlyTimes" named range from "sheet2", which contains all named ranges used for various drop down lists in the workbook. The time entry cells are in Column "O", for reference in the code below.

    That "hourlyTimes" named range already has conditional formatting applied to each and every time listed in the range, shading or coloring the cell backgrounds with a color suggesting the color of the daylight based on time of day, and dynamic based upon known sunrise and sunset time variables specified elsewhere. This is a kind of color coding template that I can change in the sheet without entering the VBA editor, styling time of day colors if needed to be harmonious with a potentially changing color palette template for the whole workbook.

    Now I need to take my time entry cells in the to-do list in "sheet1" and lookup their corresponding values in "hourlyTimes", and inherit the interior color from the corresponding address/position from "hourlyTimes".

    I presume my code would look like this, with the ask or question from the community here being to fill in the fastest method to accomplish this where my code reads ????

    Please Login or Register  to view this content.
    Attached is a jpeg with screen shot crops from sheet 1 and sheet 2, hopefully ; ) for clarity.
    Thanks for any help in advance all, much appreciated!
    Frank
    Attached Images Attached Images
    Last edited by Frank Nunez; 11-28-2020 at 01:53 PM.

  2. #2
    Registered User
    Join Date
    08-08-2020
    Location
    Boston
    MS-Off Ver
    2019
    Posts
    33

    Re: Fastest Method to Lookup Value in Named Range and Return Cell Background Color

    I'm using the FIND method right now as it works, although I have no idea if it's slow compared to loading ranges into arrays and processing that way. The code below for reference works on a test range in a sheet called TESTCODE, with integers in D6 thru D10, with corresponding integers with colored interiors in the range "testTimes".

    Sub colorTimes()

    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. Return cell background color value
    By GDM69 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-06-2016, 10:51 AM
  2. Change a Range's cell background color to that of another cell's cond. format color
    By kamelkid2 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-31-2014, 12:57 PM
  3. Change cell background color based on another cells background color
    By Queo in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 4
    Last Post: 06-10-2014, 05:28 AM
  4. [SOLVED] Using VBA to extract a max of a named array in a worksheet using the fastest method
    By luv2glyd in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-16-2014, 03:14 PM
  5. Return a cell value as well as its background color
    By ysouljah in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 12-06-2010, 09:27 PM
  6. Return a cell value as well as it's background color
    By ysouljah in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 12-02-2010, 12:32 AM
  7. return a value based on cell background color
    By mccardled in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-18-2007, 03:55 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