Can I override light blue Selection color with another color? - excel

I have a form that opens and highlights certain highly formatted rows.
The highlighting is done by selecting those rows, so they are colored light blue.
When the form closes, the rows are still selected, and that's good. The formatting beneath the selection isn't disturbed so if the user clicks anywhere on the worksheet, all the original formatting is intact.
My question is can I select rows and highlight them in a color besides standard blue (bright pink) so the user can see them more easily? I don't want to have to reformat the interior colors, and then try to figure out how to unformat them when the user is done noticing them.
sRowsToHighlight = "196:196,201:201,203:203"
m_wksPST.Range(sRowsToHighlight).Select ' Turns them blue, but I want a bright color
After my code is done, I would want selection to revert to the standard Excel color scheme.
Thanks!

I would be surprised if you could do that without manually coding it yourself. The selection colour is an application setting. You could change it in Excel, but that will change it for the whole of excel on that computer (i.e. any worksheets that get opened) and also it wouldn't help if your users are using this spreadsheet on a different computer. But here is a link anyway: http://en.kioskea.net/faq/8703-excel-changing-the-highlighting-color-of-selected-cells

Related

XSSF worksheet cells having random styles

Is there any way to set style for all next cells in excel worksheet? Like for the rest of the document after certain cell?
I am using Apache POI 3.9 for exporting data to excel worksheet. Client wants colored font for invalid data. Everything is running fine, but sometimes, when I put text in empty cells in "INFORMATION" column, it makes font colored red, even after reseting cell style or explicitly asking for condition and then setting default cell style. Youre more likely to get my idea from pic of code.
Ive uploaded some pic of excel too. Hope it helps. It starts on row 37, text somehow changes color even after not running through setting conditions. I havent recognized any pattern in there.
I tried to change conditions, change cell style setting location in code... Had no effect.
Edit: It seems like the problem is not in AP but in Excel itself. It looks like the font color is changed after user input and its caused by autoformatting that is based on the context. So only option here is to change style of previous data. Could not find any other solution to this.

Get the current Fill Color

How can I get the current Fill Color in the ribbon using VBA? I like to manually select the Fill color to highlight entire rows with. I know I can highlight an entire row with code like foo.EntireRow.Interior.ColorIndex = 3. However, instead of setting it to 3, I want to set it to the user's currently selected Fill Color in the ribbon.
I found a similar thread for Microsoft Word that uses Options.DefaultHighlightColorIndex, but I have not found one for Microsoft Excel.
Edit: Sorry for the duplicate question. I am hoping there’s a better answer that doesn’t require an active selection first. If not I’ll accept Jonathan’s answer. Currently I am just highlighting the current cell with CellFillColorPicker, getting that cell’s color and then highlighting the row with that color.
This question appears to be similar to this one: VBA - use color already select in Excel to fill cell interior
It looks like this is the code that you want:
Application.CommandBars.ExecuteMso "CellFillColorPicker"

Excel background colour changing automatically

Whenever I copy or move a cell in excel, the original cell location changes colour, how can I stop this?
I have tried clearing the format but it doesn't seem to help... and it only occurs in the main area that I am working in (i.e. if I scroll off to the side or bottom it doesn't seem to happen).
Anyone have any ideas? It's quite annoying.
Conditional Formatting should do the trick. Highlight the cells that concern you and use the option if Cell contains value... then select blank. The format should be auto background (or whatever color you would like)
You may find a custom format already there causing the issue. If so just delete it and you should be all set.

Can't seem to hide followed hyperlinks with conditional formatting

I ran into a peculiar behavior today that I need help with. I have a range(A2:C3) that I'm using conditional formatting to hide based on a yes/no dropdown (A1). It basically sets font/border/and bg color to white. There's a cell with a hyperlink (A3) to clear the contents of the range (A2:C3) which should be included when the range formatting is changed.
It works well until you click the link, then it isn't included with the range for conditional formatting for some reason. Any ideas on a solution to get followed hyperlinks to behave as new hyperlinks? I'd like to keep everything within the conditional formatting scheme to save myself a heap of work but if VBA is needed that's fine. Thanks!
Select the column, row or cells.
Format Cells
Uncheck normal font.
:)
This deselects auto formating for things like hyper links.

How can a cell's background color be set other than the obvious Cell shading property?

I can't for the life of me figure out why certain cells are shaded in a spreadsheet template I downloaded. I confirmed that the cell's shading property is set to no color. The cell has a simple formula: =SUM(J8:K8).
If the background color is being set by code in another cell, I'm not sure how to find it. Searching for the cell name (ex: B7) doesn't come up with anything. Any suggestions what could be setting the background color?
Have you had a look at the Conditional Formating options?
It could be that there's a background colour set in there.
In Office 2007 it's on the Ribbon in the Styles section on the Home tab - your best bet is to go for the "Manage Rules..." option, and then check the rules for each worksheet.

Resources