![]() ![]() Now just enter the conditional formatting to highlight the cells that have the same row as cell A1.This way it is done every time the user moves around, and as the Selection_Change is NOT changing any values/formats etc in the sheet, Undo is not disabled. I can do that with F9, but I created the Selection_Change event with the only code to be executed is Range("A1").Calculate. ![]() To make the formula in A1 to be updated, the sheet need to recalculate.In Cell A1 I put the formula =Cell("row").I found a way to do it by using combining conditional formatting, Cell() and the Selection_Change event. ![]() HighlightSelection = (Target.Row = Sheet1.SelectedRow) Or _įinally, use conditional formatting to highlight cells based on the 'HighlightSelection' formula:įirst of all Thanks! I had just created a solution with highlighting cells, using the Selection_Change and changing a cells content. ![]() Private Sub Worksheet_SelectionChange(ByVal Target as Range)Īpplication.CalculateFull ''// this forces all formulas to updateĬreate a new VBA module and add the following: Public function HighlightSelection(ByVal Target as Range) as Boolean In VBA, add the following to your worksheet object: Public SelectedRow as Integer I don't think it can be done without using VBA, but it can be done without losing your undo history: Trade off being that, if you did it this way, the highlighted column and row would have to use the same formatting, but that's probably more than adequate for most cases, and is less work. Unfortunately, not as nice as the formula and macro-based solutions (which worked for me BTW), because the highlighting goes away upon moving the cursor, but it also doesn't require the hassle of setting it up each time, or making a template with it (which I couldn't get to work).Īlso, I found you could simplify the conditional formatting formula (for Excel) from the other solutions into a single formula for a single rule as: (Thanks to !topic/docs/gJh1rLU9IRA for pointing this out) Seems to work in Excel, Google Sheets, OpenOffice Calc, and Gnumeric (all the programs I tried it in). You can temporarily highlight the current row (without changing the selection) by pressing Shift+Space. The only drawback is that every time you select a cell you need to recalculate your sheet. The best you can get is using conditional Formatting. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2022
Categories |