BrettFoster
New Member
- Joined
- Aug 8, 2013
- Messages
- 9
Hi,
The issue that I need help with is as follows: let's say I have a cell in column H labeled Analyze Issues. In column M, I have the same cell. I want create a macro that draws an arrow from Analyze Issues in column H to the the matching cell in column M.
This macro works:
Sub MG11Jan25()
Dim Rng As Range, Dn As Range
Set Rng = Range(Range("H3"), Range("M" & Rows.Count).End(xlUp))
With CreateObject("scripting.dictionary")
.CompareMode = vbTextCompare
For Each Dn In Rng
If Not IsNumeric(Dn) Then
If Not .Exists(Dn.Value) Then
.Add Dn.Value, Dn
Else
ActiveSheet.Shapes.AddLine(Dn.Left + (Dn.Width / 2), Dn.Top + (Dn.Height / 2), .Item(Dn.Value).Left + (.Item(Dn.Value).Width / 2), .Item(Dn.Value).Top + (.Item(Dn.Value).Height / 2)).Select
End If
End If
Next
End With
End Sub
However, there are two problems: I need the lines it draws to not attach to the center of the cells, but at the right end of the cells in H and at the left end of the cells in column M. Furthermore, I would like the lines to be a little offset from the end of the cells, or with a little distance between the cells edge and and the end of the arrow/line.
Regards,
The issue that I need help with is as follows: let's say I have a cell in column H labeled Analyze Issues. In column M, I have the same cell. I want create a macro that draws an arrow from Analyze Issues in column H to the the matching cell in column M.
This macro works:
Sub MG11Jan25()
Dim Rng As Range, Dn As Range
Set Rng = Range(Range("H3"), Range("M" & Rows.Count).End(xlUp))
With CreateObject("scripting.dictionary")
.CompareMode = vbTextCompare
For Each Dn In Rng
If Not IsNumeric(Dn) Then
If Not .Exists(Dn.Value) Then
.Add Dn.Value, Dn
Else
ActiveSheet.Shapes.AddLine(Dn.Left + (Dn.Width / 2), Dn.Top + (Dn.Height / 2), .Item(Dn.Value).Left + (.Item(Dn.Value).Width / 2), .Item(Dn.Value).Top + (.Item(Dn.Value).Height / 2)).Select
End If
End If
Next
End With
End Sub
However, there are two problems: I need the lines it draws to not attach to the center of the cells, but at the right end of the cells in H and at the left end of the cells in column M. Furthermore, I would like the lines to be a little offset from the end of the cells, or with a little distance between the cells edge and and the end of the arrow/line.
Regards,