Draw a Line in a Box

  • Thread starter Thread starter Barry
  • Start date Start date
Do you mean you want to add a border to a cell (or a range) and then draw a
horizontal line?
Not possible with a single cell
With a range, draw a border around each half
best wishes
 
Hi,

The only kind of interior borders that you can add are diagonal.

What's the purpose of this? You can fake it with merged cells, shapes or
pictures.
 
Bernard

I am interested in "draw a border around each half", can you explain which
method i would use??

It would be something like this

-------------------
| Buyer/Address |
| ------------------| <== like this
| Jackson |
| Somewhere |
| On Mars |
| Opp Venus |
 
Select the cell with "Buyer/Address"
Locate the border tool( in Excel 2003 it is to the right on the Format
toolbar; in Excel 2007 it is in the Font group on the Home tab). Click this
tool's launch arrow. Now select the "Outside Border" item (in Excel 2003 it
is third on the third row, in Excel 2007 it is the seventh item down)
Now your cell has a border around it

Note that the border tool nor shows a single square.
Select the four cells ( Jackson , Somewhere , On Mars, Opp Venus ) and
click the Border tool

This seems to give what you are aiming for
best wishes
 
Bernard,

I was looking for a programmatic solution, not a manual one.

maybe i am on the wrong forum.

Barry
 
Have you though of recording a macro as you carry out the step I gave?
This is wahtr I get; as with most recorded macros, iyt has some unrequirted
code that could be editied out
Sub Macro1()
'
' Macro1 Macro
' Macro recorded 14/01/2009 by Bernard V Liengme
'
Range("F6").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Range("F7:F9").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
End Sub

best wishes
 
Hi Bernard

I did find some C#/VB code in MSDN which helped me overcome the problem.
Incidentally, i used code which is along the same lines as the one provided
by you.

Thanks for your efforts.

Barry
 
Back
Top