Cell border

AlexanderBB

Well-known Member
Joined
Jul 1, 2009
Messages
1,600
After applying a new Interior.Color, how do you keep (or restore) the small dotted borders around each cell ?
 

MARK858

MrExcel MVP
Joined
Nov 12, 2010
Messages
11,724
Office Version
365, 2010
Platform
Windows, Mobile
Applying an interior.color shouldn't affect the borders, post any code that you are using.
 

Rick Rothstein

MrExcel MVP
Joined
Apr 18, 2011
Messages
35,568
Office Version
2010
Platform
Windows
Applying an interior.color shouldn't affect the borders, post any code that you are using.
I think the OP means "grid lines" (not "cell borders") as these get covered by cell fills and need to be replaced by actual cell borders (which appear above cell fills).
 

MARK858

MrExcel MVP
Joined
Nov 12, 2010
Messages
11,724
Office Version
365, 2010
Platform
Windows, Mobile
I think the OP means "grid lines" (not "cell borders") as these get covered by cell fills and need to be replaced by actual cell borders (which appear above cell fills).
Maybe, if yes then still need to know the ranges and preferably (if there is any) the code applying the color :biggrin: even then will have to take a guess with the linestyle as my gridlines are solid not dotted.
 
Last edited:

Rick Rothstein

MrExcel MVP
Joined
Apr 18, 2011
Messages
35,568
Office Version
2010
Platform
Windows
Maybe, if yes then still need to know the ranges and preferably (if there is any) the code applying the color :biggrin: even then will have to take a guess with the linestyle as my gridlines are solid not dotted.
If I look with a magnifying glass, I see mine are solid too however, to the naked eye, they look finely dotted.
 

Michael M

Well-known Member
Joined
Oct 27, 2005
Messages
18,295
Office Version
2013
Platform
Windows
Dang Rick you must have a good naked eye.....I zoomed to 400% and still look solid to me...:LOL:
 

AlexanderBB

Well-known Member
Joined
Jul 1, 2009
Messages
1,600
Hi,

Yes it is grid lines... default ones that are there if you Insert a new Worksheet.

I do have some code
Code:
 With Worksheets("Sheet1").Range("Y:CP")
        .ColumnWidth = 3
        .Interior.Color = RGB(192, 192, 192)
        .Font.Color = vbBlack
        .Font.Name = "Arial Narrow"
        .Font.Size = 10
   End With
But you get the same effect with r-click - Format - Fill
 

Michael M

Well-known Member
Joined
Oct 27, 2005
Messages
18,295
Office Version
2013
Platform
Windows
This then

Code:
Sub MM1()
With Worksheets("Sheet1").Range("Y:CP")
        .ColumnWidth = 3
        .Interior.Color = RGB(192, 192, 192)
        .Font.Color = vbBlack
        .Font.Name = "Arial Narrow"
        .Font.Size = 10
   End With
With Worksheets("Sheet1").Range("Y:CP").Borders
        .LineStyle = xlContinuous
        .Color = vbBlack
        .Weight = xlThin
    End With
End Sub
 

AlexanderBB

Well-known Member
Joined
Jul 1, 2009
Messages
1,600
Thanks Michael, it's getting closer. Color black is too dark as is RGB(192,192,192) I can't find any default color.
But vertical lines aren't wanted only horizontal. I can see whats needed in Format -Fill
so playing around with that. Not quite there yet.
 

AlexanderBB

Well-known Member
Joined
Jul 1, 2009
Messages
1,600
The color is RGB(218,220,221). r-Click-Format-Border (not Fill) wasn't quite right as I was trying to remove the default vertical lines.
I had to add a third With Clause as couldn't figure out how to include everything in one. (Presume I ave to Set Linestyle before I can remove it)

Code:
    With Worksheets("Sheet1").Range("Y:CP")
        .ColumnWidth = 3
        .Interior.Color = RGB(192, 192, 192)  'Grey
        .Font.Color = vbBlack
        .Font.Name = "Arial Narrow"
        .Font.Size = 10
    End With
    With Worksheets("Sheet1").Range("Y:CP").Borders
        .LineStyle = xlContinuous
        .Color = RGB(218, 220, 221)
        .Weight = xlThin
        End With
    With Worksheets("Sheet1").Range("Y:CP")
        .Select
        Selection.Borders(xlEdgeRight).LineStyle = xlNone
        Selection.Borders(xlInsideVertical).LineStyle = xlNone
    End With
 

Forum statistics

Threads
1,085,307
Messages
5,382,846
Members
401,807
Latest member
xlWatcher

Some videos you may like

This Week's Hot Topics

Top