I am trying to draw lines with Excel VBA and it is working nicely except for 2 things, 1) How do I make the line thicker? 2) The lines that go up and to the right do not get drawn. The ones that are horizontal or go down and to the right draw just fine.
Here is my code:
Sub DrawLine(FromCell As Range, ToCell As Range)
With FromCell.Parent.Shapes.AddLine(1, 1, 1, 1)
.Left = FromCell.Left + (FromCell.Width)
.Top = FromCell.Top + (FromCell.Height)
.Width = (ToCell.Left) - .Left
.Height = (ToCell.Top + (ToCell.Height)) - .Top
End With
End Sub
Sub GoDraw()
Call DrawLine(Range("D3"), Range("H3"))
Call DrawLine(Range("D3"), Range("H7"))
Call DrawLine(Range("D3"), Range("H11"))
Call DrawLine(Range("D7"), Range("H3"))
Call DrawLine(Range("D7"), Range("H7"))
Call DrawLine(Range("D7"), Range("H11"))
Call DrawLine(Range("D11"), Range("H3"))
Call DrawLine(Range("D11"), Range("H7"))
Call DrawLine(Range("D11"), Range("H11"))
End Sub