Highlight cells determined by active cell

Discuss the spreadsheet application
Post Reply
canariohippie
Posts: 9
Joined: Mon Jan 09, 2017 8:19 pm

Highlight cells determined by active cell

Post by canariohippie »

Regards:

How can I make certain cells to be highlighted depending on where the active cell is? , I explain, looking, what I find mostly are examples in which the entire row and column where the active cell (in the shape of a cross) is highlighted through macros, but what I want, and in relation To the attached file is that if I am in cell E14, for example, only cells E7 ("Sales"), and A14 and B14 ("Luis León Parra") are highlighted.

Highlight by active cell.ods
(23.92 KiB) Downloaded 204 times
Example of cell highlighting according to the active cell
Example of cell highlighting according to the active cell
Captura.jpg (35.69 KiB) Viewed 3650 times
LibreOffice 5.2.0.4 on Windows 10 Pro
FJCC
Moderator
Posts: 9274
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Highlight cells determined by active cell

Post by FJCC »

Why isn't the solution given to you at https://forum.openoffice.org/es/forum/v ... 641#p55790 adequate?
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
canariohippie
Posts: 9
Joined: Mon Jan 09, 2017 8:19 pm

Re: Highlight cells determined by active cell

Post by canariohippie »

FJCC wrote:Why isn't the solution given to you at https://forum.openoffice.org/es/forum/v ... 641#p55790 adequate?
Hello:

- Because I look for other alternatives, if possible, that have less lag when moving the active cell. The macro I inserted in a file with many more cells and there is much notice the lag. Perhaps an alternative that combines it with conditional formats, I do not know.

- Because by selecting outside the established ranges I continue marking the cells. Outside the established ranges I would not want to mark the cells. That probably can be solved by the creator of the macro (@fornelasa), but as I am preferably looking for another alternative, I do not want to disturb @fornelasa, until I decide to insert his macro or not.

Thank you for your attention.
LibreOffice 5.2.0.4 on Windows 10 Pro
FJCC
Moderator
Posts: 9274
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Highlight cells determined by active cell

Post by FJCC »

I think it would be good to give fornelasa your feedback, but that is up to you. I believe he visits this forum sometimes, so he may see this in any case.
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
canariohippie
Posts: 9
Joined: Mon Jan 09, 2017 8:19 pm

Re: Highlight cells determined by active cell

Post by canariohippie »

You're right, I've been very inconsiderate, yet I would value another alternative or solution to my problem.

Thank you for your time and knowledge.
LibreOffice 5.2.0.4 on Windows 10 Pro
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Highlight cells determined by active cell

Post by Villeroy »

crosshighlight.ods
Highlight cross at active cell
(19.92 KiB) Downloaded 194 times
The feature is activated by the document's "View Created" event. See Tools>Customize... [Events]
In order to highlight the row only, you've got to comment out one line of code in Module2. See remark in that module.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
Lupp
Volunteer
Posts: 3549
Joined: Sat May 31, 2014 7:05 pm
Location: München, Germany

Re: Highlight cells determined by active cell

Post by Lupp »

Wouldn't highlighting based on the current selection require to restore the previous attributes for cells no longer meeting the conditions for highlighting? Checking for possible solutions I think of doing the highlighting only for the grid contained in the current view which seems to be the way conditional formatting is doing it, and not to assign attributes to the cells. On the other hand I never could find a service to do so. Might it be a appropriate to create a temporary CF? Is there a helpful interface?
On Windows 10: LibreOffice 24.2 (new numbering) and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Highlight cells determined by active cell

Post by Villeroy »

"Highlighting" means that we temporarily apply a specific (background/font/border/whatever) color to some cells without changing any other attribute. Therefore I implemented this by means of hard formatting. When the selection changes, I reset this formatting attribute to its default value which is defined in its underlying cell style. Of course, when you work with hard attributes all over the sheet (like most users do), my macro may interfere with your own hard coded colours. The grid colour applies to the entire grid. You can not specify the grid colour for a range of cells. But borders should work as well. If you have lots of hard coded background colours, you should choose borders for highlighting.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
Lupp
Volunteer
Posts: 3549
Joined: Sat May 31, 2014 7:05 pm
Location: München, Germany

Re: Highlight cells determined by active cell

Post by Lupp »

(Personally I will not use the "feature". I just commented the solution from a general point of view.)
On Windows 10: LibreOffice 24.2 (new numbering) and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München
Post Reply