+ Reply to Thread
Results 1 to 6 of 6

Highlight all cells in a column based on values in two different cells

  1. #1
    Registered User
    Join Date
    10-25-2014
    Location
    Tennessee
    MS-Off Ver
    2010
    Posts
    1

    Highlight all cells in a column based on values in two different cells

    Highlight Cells.xlsxHello,

    Really new to VBA. Looking for help with highlighting cells in a column based on the value of two differnt cells.

    I have a list of values in "A1:A10" as 1,2,3,4,5,6,7,8,9,10

    Cell B1 contains the value of 3
    Cell C1 contains the value of 7

    I would like to highlight all cells in column A that fall between the values in B1 and C1.

    I have attached a sample .

    Thanks in advance for the help.

    Linnie

  2. #2
    Forum Expert Crooza's Avatar
    Join Date
    10-19-2013
    Location
    Hunter Valley, Australia
    MS-Off Ver
    Excel 2003 /7/10
    Posts
    2,082

    Re: Highlight all cells in a column based on values in two different cells

    Hi, welcome to the forum and yes you can use VBA but you can also set a formula and conditionally format based on a simple formula.

    I'm on iPad at present so this is untested but if you got to conditional format -> choose CF by formula -> and write a formula like =and($a1> $b$1, $A1<$c$1) and apply to cells a1 to A10 and set the format to the shading you want you should get the same result.

    Give it a go. If it doesn't work let me know and I'll fire up the laptop and fix it up for you.
    Happy with my advice? Click on the * reputation button below

  3. #3
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,583

    Re: Highlight all cells in a column based on values in two different cells

    Pl see attached file.
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    08-29-2012
    Location
    Hyderbad
    MS-Off Ver
    Excel 2003
    Posts
    122

    Re: Highlight all cells in a column based on values in two different cells

    Hi Crooza,

    I have taken entire range ("a:a") like this : j = Sheets("sheet2").Range("a" & Rows.Count).End(xlUp).Row

    Please find the code :

    Please Login or Register  to view this content.
    If any issues please....

  5. #5
    Registered User
    Join Date
    03-12-2014
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    41

    Re: Highlight all cells in a column based on values in two different cells

    Or you could try this? I haven't tested please do let me know if there's any issues.

    Name your sheet as appropriate

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    03-12-2014
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    41

    Re: Highlight all cells in a column based on values in two different cells

    Sorry posted twice in error - EDIT -
    Last edited by jayesh25; 10-26-2014 at 06:28 AM. Reason: Double post

+ 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] VBA help need to highlight the cells based on the dates and insert respective cell values.
    By krjoshi in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-24-2014, 11:14 PM
  2. Replies: 5
    Last Post: 09-24-2012, 05:14 PM
  3. Replies: 0
    Last Post: 07-22-2011, 12:11 PM
  4. Replies: 23
    Last Post: 09-25-2009, 07:39 PM
  5. Replies: 1
    Last Post: 09-19-2009, 08:09 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