I'm trying to figure out the particular border style of cell within a workbook that I received. The normal way to do this would be ctrl+1->Border and look at the style. However, the style for this particular cell is blanked out and I suspect that the border is formatted using a proprietary style. How do I get the properties of this border style (I guess with VBA?) in order to set up my own macro which then applies this particular border style to other cells?
I hope someone can help me out here.
EDIT:
In Excel, select the cell with the border in question.
Change to the VBE environment (Alt+F11). Open the Immediate Window (Ctrl+G).
Type in the immediate window:
? ActiveCell.Borders(xlEdgeBottom).LineStyle
And
? ActiveCell.Borders(xlEdgeBottom).Weight
Compare the values with the documentation:
https://learn.microsoft.com/en-us/office/vba/api/excel.xllinestyle
https://learn.microsoft.com/en-us/office/vba/api/excel.xlborderweight
It would surprise me it one of the two values cannot be found in the lists.
I believe you need to add bold white borders to the left and right-hand sides of the cell to generate the effect.
Related
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.
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"
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
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.
I have a file with Excel 97-2003 (.xls) version. When this file is opened in Excel 2013, shows black arrowheads in right bottom corner of the cell. These arrows are only in cells B3:J3 and F4. All these cells contains integer numbers. To get an idea what I want to convey please have a look at following image.
Things i have tried to remove arrowheads
Clear content and insert data again. (Arrow head is still there even if I remove data.)
Clear formatting.
Use Format painter and format the cells having arrowhead with the format of cells not having arrowhead.
Deleting the cells. (If I delete the cells, these arrows get shifted to cells above it)
Removing the conditional formatting from these cells.
Interesting thing is when I try to print the sheets the arrowheads vanish in print preview. I want to get rid of the black arrowheads (or triangles) in the excel sheet.
Thanks in advance... :)
Edit:
Things i have tried to remove arrowheads in addition to above mentioned
"Remove Arrows" from "Formulas" tab
In the 'home' tab on the ribbon, click 'select & find', then 'selection pane'.
If there is anything in this pane, select and delete it and that will probably remove the arrows.
Also, in the 'Formulas' tab in the ribbon, click 'Remove arrows'
Function Key and F5 at the same time in the cell in which the black arrowhead appears.
Click on Special.
Click on Objects.
A gray circle will appear.
Hit the delete key
and the black arrowhead will disappear