+ Reply to Thread
Results 1 to 8 of 8

Shading cells based on a value in another cell

  1. #1
    Registered User
    Join Date
    02-26-2009
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    2

    Shading cells based on a value in another cell

    New to forum - I would like to shade a range of cells based on a value entered in another cell. For example if I enter "5", I would like to shade the next 5 cells in a row. I have tried conditional formatting, but have not been successful. Thank you in advance for your help!

  2. #2
    Forum Contributor
    Join Date
    01-16-2009
    Location
    Ill.
    MS-Off Ver
    Excel 2010
    Posts
    190

    Re: Shading cells based on a value in another cell

    Hi

    I've just did something similar but with bold and indents. I would assume that you could do the same by using offset(0,1)....here is a portion of my code (this looks in A2 and compares that value to H2)..if they are the same then it will indent the value in C2.

    Please Login or Register  to view this content.
    Hope that helps
    Last edited by Ironman; 02-26-2009 at 05:45 PM.

  3. #3
    Forum Contributor
    Join Date
    01-16-2009
    Location
    Ill.
    MS-Off Ver
    Excel 2010
    Posts
    190

    Re: Shading cells based on a value in another cell

    Hey L_girl - I took another look at put this quick VBA code together, I think this is a little more complete of an example. I'm not as good of a VBA'r as many of the folks on this forum, so if anyone has other suggestions for improving this code then by all means...I'm sure there is a much more effective way to do this but at the very least this should get you started....

    Please Login or Register  to view this content.
    Have a good day...

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988

    Re: Shading cells based on a value in another cell

    Ironman,

    Maybe

    Please Login or Register  to view this content.
    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  5. #5
    Forum Contributor
    Join Date
    01-16-2009
    Location
    Ill.
    MS-Off Ver
    Excel 2010
    Posts
    190

    Re: Shading cells based on a value in another cell

    Short and sweet..nice

    Tell me, what does

    Please Login or Register  to view this content.

    Do...?

  6. #6
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988

    Re: Shading cells based on a value in another cell

    As the cell will have a value I use the resize method to resize the range to that number of cells. Search excel help or take a look at the below for more

    http://msdn.microsoft.com/en-us/library/aa139976.aspx

    VBA Noob

  7. #7
    Forum Contributor
    Join Date
    01-16-2009
    Location
    Ill.
    MS-Off Ver
    Excel 2010
    Posts
    190

    Re: Shading cells based on a value in another cell

    A much better method...thanks for the input and the link, I've saved that link as it will be useful down the road...thanks again, enjoy your weekend...

  8. #8
    Registered User
    Join Date
    02-26-2009
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Shading cells based on a value in another cell

    Thank you for the quick responses... I will give this a try.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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