+ Reply to Thread
Results 1 to 3 of 3

Macro to look at another cell, check for text and amend the fill of the current cell

  1. #1
    Registered User
    Join Date
    03-27-2012
    Location
    Sydney
    MS-Off Ver
    Excel 2007
    Posts
    2

    Macro to look at another cell, check for text and amend the fill of the current cell

    Hi guys.

    As well as other things, I have code in play that auto-sums (sub AutoSum) in Column F the count of cells up until a new blank row appears, then formats the cell with the sum with an orange (RGB(204, 102, 0)) fill.

    Then I use the code below to change the fill to green if the value is less than 14:

    Please Login or Register  to view this content.
    The problem is I need the second format change (listed above) to be altered slightly, or replicated and adjusted in another line of code, where if the word 'SAMP' sits anywhere in the cell (always in Column B) that is 1 row up and 4 columns behind the cell having the sum added to it (always in Column F) that the colour should change to green only if the value is less than 12 (not 14).

    In my attachment, an example of this would be that F12 should not be green, as for these SAMP products (SAMP is found in cell B11) the maximum should be 12. Therefore is should stay orange, or go back to being orange.

    I believe I need to use range offsets and combine them with some sort of 'Like' or 'InStr' code but I can't work out how to do it.

    If this is confusing, sorry!

    Thanks heaps.
    Attached Files Attached Files
    Last edited by ensanguined; 06-13-2017 at 12:06 AM.

  2. #2
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Macro to look at another cell, check for text and amend the fill of the current cell

    Hi ensanguined,
    try so
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    03-27-2012
    Location
    Sydney
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Macro to look at another cell, check for text and amend the fill of the current cell

    Thanks so much nilem! That looks to have worked perfectly, even enabling me to clean up my code a little by removing the other sub that was called. Thanks again!

+ 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] Amend code to check cell A2 has data in before running
    By robertguy in forum Excel General
    Replies: 2
    Last Post: 12-11-2016, 09:13 AM
  2. [SOLVED] Amend Formula To Check if Cell ‘A2’ Has Data Entered
    By robertguy in forum Excel General
    Replies: 5
    Last Post: 12-01-2016, 07:36 AM
  3. Create Macro to fill cell with text charters into cell that selected
    By jk3700 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-01-2016, 09:58 PM
  4. [SOLVED] Check text in adjacent cell and accordingly fill text from master reference
    By bcmehta in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-11-2016, 08:15 AM
  5. [SOLVED] Amend Macro to use data in current cell as the search criteria..
    By Craigside in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-01-2016, 04:32 AM
  6. Replies: 12
    Last Post: 12-10-2013, 02:10 AM
  7. Copy text from one cell and amend it and add it to adjacent cell
    By mmmsghs in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-23-2013, 11:57 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