Excel background colour changing automatically - excel

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.

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.

Prevent Blank Cells with Data Validation

I'm having a seriously hard time with the simplest of Excel data validations: how do you prevent a blank value? The user needs to enter a number into a cell. If the cell has no value, Excel should throw up an error message. I've tried the following:
=COUNTIF($A5:$A27, "")=0
=ISBLANK($A5)
=ISBLANK($A5)=FALSE
and a whole assortment of ridiculous Excel gymnastics, but nothing has worked. The Ignore Blank checkbox is off, too. How hard can this be?
This is in Excel 2016 running on Windows 10. I've tried Google searches ad nauseum with different search keywords. I've tried winging it. I've tried searching on here fora simple formula to solve the problem.
Assuming you also don't want to allow a value of 0 to be entered, you can use the following validation. However, validation only applies when you're entering values into a cell. If you're in edit mode, you won't be able to hit Enter while the cell is blank. But there's nothing to stop you from ignoring the cell entirely or even selecting the cell and clearing it's contents using the Delete key.
There's no way for Excel to force fields to be mandatory and with good reason. If Excel wasn't going to let you do anything while a mandatory cell was empty, you would be stuck if there were two mandatory cells because you could never complete one cell without Excel complaining about the other cell.
You can only force cells to be mandatory when you're also running macros which could display error messages instead of performing the required tasks if the mandatory fields aren't all complete.
As per the comment, the best thing to do is highlight empty mandatory cells using conditional formatting. From the Home tab, create conditional formatting based on value equal to 0 then set the background format to red (or whatever you want).

VBA Clear formatting hides line breaks until formula bar is activated? Why?

I have noticed that when clearing formatting, .ClearFormats, of a sheet in Excel via VBA it also appears it clears the line feeds in text strings inside cells. However, when you click and activate the formula bar and exits it again, the line feeds reappears.
What is going on? And is there a way to show the line feeds in the cells again with VBA? I am currently clearing formatting for faster savings (cell colorings are slowing down my saving time), and I would like to avoid having to manually click every header and the formula bar everytime.
This is my procedure at the moment. (I had to add one image instead of four since I do not have enough reputation points for more than two links.)
After my code is run and formatting is done.
Then I run the line ActiveWorksheet.Cells.ClearFormats
If I run my formatting procedure again (unchanged text strings in cells)
I then click on cell D1 --> Click in formula bar --> Click in random other cell
Print Screens of the different stages of the explained procedure
Why is this happening? And is there a way to avoid it without resetting default formatting for each "format setting" (e.g. background color, border, font etc.)?
Add a ActiveWorksheet.Cells.WrapText = True after your ActiveWorksheet.Cells.ClearFormats
Or specialize it to a range of cells if not all cells should be wrapped.

Can I override light blue Selection color with another color?

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

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.

Resources