(Solved) – Send borders to the back of the text in cell


I suspect this question doesn’t have a satisfactory answer, but I’ll ask it anyway: is there a way to send the “inside borders” of a cell – specifically the xlDiagonalDown and xlDiagonalUp ones, but the question can potentially be extended to the xlInsideHorizontal and xlInsideVertical ones – to the back of the text in cell (or, if you like, bring the text in front of them)? If the answer is the expected no, can those borders be drawn using a semi-transparent or translucent color so they’re not obstructing the view of the text inside the cell (like below)?

                                              Excel Diagonal Borders Overriding Cell Text

I’m asking this because I’m drawing a map in the sheet I’m working with and I was wondering if I could represent the roads/railroads on the map using the cells’ diagonal borders. Right now I’m successfully representing the rivers using the xlEdgeBottom and xlEdgeRight borders and I’m already representing the roads/railroads using abbreviations within the cell value string (e.g. roa for roads, rai for railroads), but thought about making the routes representation more expressive visually. I tried using the cells’ diagonal borders, but Excel seems to override the cell text when drawing them – and yes, I’m assigning values to the cells from an array after I’m drawing the borders (simplified sample below).

    Cells(3, 3).Borders(xlDiagonalUp).Weight = xlThin
    Cells(3, 3).Borders(xlDiagonalUp).Color = vbWhite
    Cells(3, 3).Borders(xlDiagonalDown).Weight = xlThin
    Cells(3, 3).Borders(xlDiagonalDown).Color = vbWhite

Note: I’m not thinking about background images or shapes because of speed considerations. My “map” is made of around 26000 cells (basically Byte x Byte).

Leave a Reply

Your email address will not be published. Required fields are marked *