johanssson
09-15-2016, 12:33 AM
Hi, I would appreciate some coding help from all experts in here.
I'm about to analyze our picking operations and all positions have an identifier so the picker
picks the articles in correct order. So my idea is to analyze if the picking route is correctly set up.
so in order to simplify it i would like to draw lines between all positions in correct order.
For instance,
First line between Position 1 to 2
Second line from position 2 to 3
So I would like the macro to draw the line to the next high value and sometime it could be from 6-8 because 7 is
not specified.
i found this code earlier but it draw only lines between equal values.
Sub drawline()
Dim Rng As Range, Dn As Range
Set Rng = Range(Range("A1"), Range("d" & Rows.Count).End(xlUp))
With CreateObject("scripting.dictionary")
.CompareMode = vbTextCompare
For Each Dn In Rng
If IsNumeric(Dn) Then
If Not .Exists(Dn.Value) Then
.Add Dn.Value, Dn
Else
ActiveSheet.Shapes.AddLine(Dn.Left + (Dn.Width / 3), Dn.Top + (Dn.Height / 3), _
.Item(Dn.Value).Left + (.Item(Dn.Value).Width / 3), .Item(Dn.Value).Top _
+ (.Item(Dn.Value).Height / 3)).Select
End If
End If
Next
End With
End Sub
I'm about to analyze our picking operations and all positions have an identifier so the picker
picks the articles in correct order. So my idea is to analyze if the picking route is correctly set up.
so in order to simplify it i would like to draw lines between all positions in correct order.
For instance,
First line between Position 1 to 2
Second line from position 2 to 3
So I would like the macro to draw the line to the next high value and sometime it could be from 6-8 because 7 is
not specified.
i found this code earlier but it draw only lines between equal values.
Sub drawline()
Dim Rng As Range, Dn As Range
Set Rng = Range(Range("A1"), Range("d" & Rows.Count).End(xlUp))
With CreateObject("scripting.dictionary")
.CompareMode = vbTextCompare
For Each Dn In Rng
If IsNumeric(Dn) Then
If Not .Exists(Dn.Value) Then
.Add Dn.Value, Dn
Else
ActiveSheet.Shapes.AddLine(Dn.Left + (Dn.Width / 3), Dn.Top + (Dn.Height / 3), _
.Item(Dn.Value).Left + (.Item(Dn.Value).Width / 3), .Item(Dn.Value).Top _
+ (.Item(Dn.Value).Height / 3)).Select
End If
End If
Next
End With
End Sub