Page 1 of 1

Highlight cells determined by active cell

Posted: Sat Jan 14, 2017 2:36 pm
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 252 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 4257 times

Re: Highlight cells determined by active cell

Posted: Sat Jan 14, 2017 2:48 pm
by FJCC
Why isn't the solution given to you at https://forum.openoffice.org/es/forum/v ... 641#p55790 adequate?

Re: Highlight cells determined by active cell

Posted: Sat Jan 14, 2017 3:04 pm
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.

Re: Highlight cells determined by active cell

Posted: Sat Jan 14, 2017 3:34 pm
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.

Re: Highlight cells determined by active cell

Posted: Thu Jan 19, 2017 6:39 am
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.

Re: Highlight cells determined by active cell

Posted: Thu Jan 19, 2017 10:09 am
by Villeroy
crosshighlight.ods
Highlight cross at active cell
(19.92 KiB) Downloaded 250 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.

Re: Highlight cells determined by active cell

Posted: Thu Jan 19, 2017 12:03 pm
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?

Re: Highlight cells determined by active cell

Posted: Thu Jan 19, 2017 1:30 pm
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.

Re: Highlight cells determined by active cell

Posted: Fri Jan 20, 2017 2:54 am
by Lupp
(Personally I will not use the "feature". I just commented the solution from a general point of view.)