+ Reply to Thread
Results 1 to 5 of 5

Highlighting cells in a specific distance to the selected cell

  1. #1
    Registered User
    Join Date
    04-05-2022
    Location
    Greifswald, Germany
    MS-Off Ver
    2016 and 2021
    Posts
    2

    Question Highlighting cells in a specific distance to the selected cell

    Hello,

    I am stuck with the following problem: I want to highlight a set number of cells in a specific distance when selecting a cell.

    For example:

    I select cell A1 and A1; A11; H1 and H11 get highlighted.
    Now I switch to A2 and A2; A12; H2 and H12 get highlighted.
    Same with D1 - D1; D11; K1 and K11 get highlighted and so on.


    I have already worked with cases / Case Select in a Worksheet with Selection Change where you state every result when a case takes effect.
    My Workbook Range comprises 14 rows and 37 columns - so 518 cases with 4 results each. As you can imagine I would like to avoid coding that. (would probably be to big anyways)

    The "distance" to the to be highlighted cells never changes.

    Is there a way to shortcut this?

    Thanks in advance!
    Philipp

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,425

    Re: Highlighting cells in a specific distance to the selected cell

    Something like:

    Please Login or Register  to view this content.
    You will, of course, need to reset any previous selection changes.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Valued Forum Contributor
    Join Date
    06-27-2010
    Location
    sYRIA
    MS-Off Ver
    Excel 2013
    Posts
    669

    Re: Highlighting cells in a specific distance to the selected cell

    Hi
    May be some thing like
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    04-05-2022
    Location
    Greifswald, Germany
    MS-Off Ver
    2016 and 2021
    Posts
    2

    Re: Highlighting cells in a specific distance to the selected cell

    Hi,

    I tested both solutions and added a (sheetname).Cells.Interior.ColorIndex = xlColorIndexNone in front.
    They work perfectly fine.

    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: Highlighting cells in a specific distance to the selected cell

    Perhaps


    Please Login or Register  to view this content.
    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.

+ 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. Highlighting Row When A Cell In That Row Is Selected
    By KAELondon in forum Excel Programming / VBA / Macros
    Replies: 30
    Last Post: 06-11-2020, 04:02 PM
  2. Replies: 15
    Last Post: 01-29-2020, 04:38 PM
  3. [SOLVED] highlighting cells in row based on specific cell value
    By monika_s in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-20-2017, 10:48 AM
  4. Highlighting selected cells in column B and C
    By chrisjack in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-05-2012, 04:36 PM
  5. Highlighting and performing macros on selected cells only?
    By jfbouchard in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-31-2012, 06:54 PM
  6. Selected Cell Highlighting
    By boylejob in forum Excel General
    Replies: 3
    Last Post: 08-05-2010, 04:04 PM
  7. Highlighting a Row when a cell is selected
    By julvaz in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-18-2007, 02:56 AM

Tags for this Thread

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