PDA

View Full Version : Solved: BorderAround only displays on 1 quadrant



YellowLabPro
03-16-2007, 06:50 AM
I have a small procedure that changes the border to a particular look. But it is on a group of merged cells. The problem is that it only displays on the upper left quadrant.
I tested it on a single cell and it is fine. I tested the menu button on merged cells and that works fine, so I see that merged cells can have a consistent border.


Sub Instructions()
ActiveCell = ("INSTRUCTIONS:" & Chr(10) & "All Purchase Orders Must be Visible on the Outside of the Box." _
& Chr(10) & "Call before Pack/Ship for approval by buyer. Failure to do so could result in refusal of shipment.")
With ActiveCell
.Interior.ColorIndex = 6
.Font.ColorIndex = 3
.Font.Bold = True
.BorderAround Weight:=xlThick, ColorIndex:=3

End With

End Sub


Thanks,
YLP

lucas
03-16-2007, 09:01 AM
Hi YLP,
You should know by now from other posts in this forum that merged cells are a problem... Use center across selection with the cells unmerged. Avoid merged cells at all costs is my motto.

YellowLabPro
03-16-2007, 09:09 AM
Hi Lucas,
Thanks. I was unaware of the merging problems :(
But I did test it to see if merged cells could be formatted w/ a border through Excel. Since that was successful I thought there might be something else necessary to put in my code to deal w/ it.
I cannot alter the sheet I am working w/ deleting the merged cells. This is from a company that I order from, it is there proprietary worksheet. I have to work w/ it the way it is given to me.


Thanks,

YLP

mdmackillop
03-16-2007, 09:20 AM
OK, we believe you!
so try

Sub Instructions()
ActiveCell = ("INSTRUCTIONS:" & Chr(10) & "All Purchase Orders Must be Visible on the Outside of the Box." _
& Chr(10) & "Call before Pack/Ship for approval by buyer. Failure to do so could result in refusal of shipment.")
With ActiveCell
.Interior.ColorIndex = 6
.Font.ColorIndex = 3
.Font.Bold = True
With .MergeArea.Borders
.LineStyle = xlContinuous
.Weight = xlThick
.ColorIndex = 3
End With
End With
End Sub

YellowLabPro
03-16-2007, 09:25 AM
Thanks Malcolm,
That worked. Sorry, hope I did not come off badly....