How can i give an exact worth to a line around a cell (cellformat)

  • Thread starter Martin de Jonge
  • Start date
M

Martin de Jonge

In Excel there are many ways you can draw a line and give in the worth of
thickness. But i want to know how i can do the same with the borders around
a cell. In example... i give my cell a border with the thickness of 0.25 pt.

Who can help me with this problem?
 
J

JE McGimpsey

Martin de Jonge said:
In Excel there are many ways you can draw a line and give in the worth of
thickness. But i want to know how i can do the same with the borders around
a cell. In example... i give my cell a border with the thickness of 0.25 pt.

AFAIK, borders have to be one of the preset thicknesses and styles.

As a workaround, you can create a Text box, size it to match the cell,
set the border thickness and set Move and Size with cell in the
Properties tab. Set Fill transparancy to 100%.

Note that this precludes selecting the cell with the mouse (unless you
assign a macro that selects the underlying cell), though the tab and
arrow keys still will select. Therefore it's most useful for cells that
will not receive user input.
 
B

Bernard Rey

In Excel there are many ways you can draw a line and
give in the worth of thickness. But i want to know how
i can do the same with the borders around a cell.
In example... i give my cell a border with the thickness
of 0.25 pt.

As far as I can see, there is no way to do that. If you
look at the possibilities in the Visual Basic Editor,
there are only four possible values.
Sub TestBorder()
Range("B8").BorderAround Weight:=xlHairline 'or =1
Range("B10").BorderAround Weight:=xlThin 'or =2
Range("B12").BorderAround Weight:=xlMedium 'or =3 or -4138
Range("B14").BorderAround Weight:=xlThick '=4
End Sub

One possible Workaround would be to draw a rectangle
around the selected cells :

Sub DrawRectangle()
With Selection
MyLeft = .Left
MyTop = .Top
MyWidth = .Width
MyHeight = .Height
End With
ActiveSheet.Shapes.AddShape(msoShapeRectangle, _
MyLeft, MyTop, MyWidth, MyHeight).Select
With Selection.ShapeRange
.Fill.Visible = msoFalse
.Line.Weight = 0.25
End With
End Sub

Well this is what I could suggest. But there might be
other (better) ways...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top