+ Reply to Thread
Results 1 to 6 of 6

Custom Contitional Formatting to format some cells that are in line with ActiveCell

  1. #1
    Registered User
    Join Date
    02-14-2013
    Location
    Seaton, Devon, UK
    MS-Off Ver
    Excel 2010
    Posts
    6

    Custom Contitional Formatting to format some cells that are in line with ActiveCell

    Hi

    I would like to temporarily format some cells in the row of the ActiveCell and some cells in the column of the ActiveCell. This is like what happens with the headings in a sheet but I need to highlight cells in the body of the WorkSheet. Can anyone help me please?

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Custom Contitional Formatting to format some cells that are in line with ActiveCell

    This is harder than you think.

    But this has been solved,

    You need conditional formatting and a sheet specific macro to do this.

    The attached file does what you want and more

    You will need to modify the conditional formats to remove the vertical line.


    The sheet specific macro needs to run when you change your selection, it effectively switches to a second sheet and back again to force excel to apply the conditional formatting.

    If your spreadsheet only was one sheet, the macro will create a second sheet.

    Right Click on the sheet name and select view code to see the code.
    Attached Files Attached Files
    Last edited by mehmetcik; 11-08-2015 at 07:57 AM.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Registered User
    Join Date
    02-14-2013
    Location
    Seaton, Devon, UK
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Custom Contitional Formatting to format some cells that are in line with ActiveCell

    Thanks mehmetcik, That looks like what I need. I have not applied it to Project but I cannot as yet see a problem. Will mark this as solved when I have tried it. It might be a few days until I can get the time to work on it.

    Regards Mike

  4. #4
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: Custom Contitional Formatting to format some cells that are in line with ActiveCell

    @mehmetcik: just out of curiosity, is there any special reason why you add the extra worksheet?
    I removed that part of the code and on selection change is sufficient, it works.
    Just the fact that you select another cell is enough to trigger it.
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  5. #5
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: Custom Contitional Formatting to format some cells that are in line with ActiveCell

    I knew it was somewhere: This Addin does the same thing
    http://www.cpearson.com/excel/rowliner.htm
    I used this about 12 years ago

  6. #6
    Registered User
    Join Date
    02-14-2013
    Location
    Seaton, Devon, UK
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Custom Contitional Formatting to format some cells that are in line with ActiveCell

    Thanks to you both. mehmetcik's was the solution I needed, to fill a part row of cells that are to the right but not adjacent to the active cell and similarly a part column of cells below and not adjacent to the active cell. Keebellah is right the code can be reduced

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)

    Target.Calculate

    End Sub

    The cross hairs of Keebellah are not what I was looking for.

    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. Replies: 7
    Last Post: 08-06-2014, 08:47 AM
  2. [SOLVED] Contitional formatting between two columns - one tests the other
    By mrnoonan in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-16-2013, 09:53 PM
  3. [SOLVED] Formatting Excel Cell (custom format)
    By MaxM&M in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-13-2013, 08:29 PM
  4. counting colored cells while using contitional formatting
    By okg in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-21-2011, 02:50 PM
  5. [SOLVED] Contitional formatting help
    By Jeff in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 06-16-2006, 03:40 PM
  6. cannot delete contitional formatting
    By Robert in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-28-2005, 07:05 PM
  7. [SOLVED] Contitional copying of cells from one tab to another
    By Junkyard Engineer in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-18-2005, 06:05 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