Making a border a specific color

easybpw

Active Member
Joined
Sep 30, 2003
Messages
433
Office Version
  1. 365
  2. 2013
Platform
  1. Windows
I was wondering if there is a way to make a cell border a specific color? I know you can have a full border but the color defaults to black/grey. This would be extremely helpful to me.

Thanks for the help!

Bill
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Hi Bill

Assuming you mean in code then this puts borders round range A1 to A8 and makes the border red.
Code:
Sub Borders()
With ActiveSheet.Range("A1:A8").Borders
    .LineStyle = xlContinuous
    .ColorIndex = 3
End With
End Sub

Does this help or have I misunderstood?

Regards
 
Upvote 0
Actually no. I'm sure I wasn't clear but...the unique cells aren't constant and don't go in order. In a column of 20 rows only 3 could be unique. I'm thinking this is probably impossible.

Bill
 
Upvote 0
Bill

Is there some specific criteria for the cells you want? What cells in particular are you looking at? Do they contain some kind of data or are they blank
 
Upvote 0
The cells are blank. Once I find a way to uniquely mark certain cells a macro is run from another sheet and then will put data in the cells. But the cells need to remain empty, I just need to find a way to mark them as unique.

Thanks for the help. I know I am not clear enough but it is hard to translate.

Bill
 
Upvote 0
Start at the beginning and tell us a story. "I start with a blank worksheet. In cells C4, C8, and D42 I need to have the border changed to purple with pink stripes. Later, I will import data into this sheet using VBA to get data from another workbook."

Or whatever. Think through what you want to accomplish step by step. Then tell that story. Nevemind if it's possible, or how to do it - the gurus on this board will help you with that. YOUR job is to lay out the problem clearly.
 
Upvote 0
You can’t use the HTML maker at the moment.

If it’s just blank cells then try this – you’ll need to adjust the range to suit.
Code:
Sub Borders2()
Dim myRng As Range
Dim newRng As Range

Set myRng = Range("A1:H4")
Set newRng = myRng.SpecialCells(xlCellTypeBlanks)

newRng.Interior.ColorIndex = 6
End Sub

Does this help?

Regards
 
Upvote 0

Forum statistics

Threads
1,203,453
Messages
6,055,533
Members
444,794
Latest member
HSAL

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top