+ Reply to Thread
Results 1 to 6 of 6

Excel 2007 : Format previous cell based on current cell

  1. #1
    Registered User
    Join Date
    12-03-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2007
    Posts
    14

    Thumbs up Format previous cell based on current cell

    I need it done through VBA!

    In column A the names are followed by their presence (Absent/Present),
    I just want to color the names based on present or absent.

    So Sunny was present so color that cell in Green
    & Rocky was absent so mark him in Red

    A1 Names (Header)
    A2 Sunny
    A3 Present
    A4 Sam
    A5 Present
    A6 Tom
    A7 Present
    A8 Rocky
    A9 Absent
    A10 Raw
    A11 Absent
    A12 Dave
    A13 Absent
    Last edited by IamHarish; 12-03-2011 at 11:32 AM. Reason: Don't wanna waste time of mine & others as well

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Format previous cell based on current cell

    Hi,

    Use conditional formatting. Create two Cond. formats

    Please Login or Register  to view this content.
    set the colour to red and apply it to A$3:A$13
    Do the same with the second Cond. format
    Please Login or Register  to view this content.
    and colour it green.

    Regards
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Format previous cell based on current cell

    I see there was a late edit. Why use the slower VBA route when there's a perfectly efficient conditional format option?

  4. #4
    Registered User
    Join Date
    12-03-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Format previous cell based on current cell

    Dear! I want previous cell to be formatted not the current cell.
    If A3 contains "Present" only then format A2.
    and Why VBA - Coz this is small part of my project, where as I have a VBA to do many several things & along with that code I need this to be added, VBA code is much appreciated!, thanks!

  5. #5
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Format previous cell based on current cell

    Sorry I should have clarified. That CF should go in A2 and refer to A$3:A$13. I know you want it applied to the name cell not the Presence or Absence cell.

  6. #6
    Registered User
    Join Date
    12-03-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2007
    Posts
    14

    SOLVED: Format previous cell based on current cell

    ok, thanks!

+ 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